pyedb 0.22.1__py3-none-any.whl → 0.24.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pyedb might be problematic. Click here for more details.

Files changed (41) hide show
  1. pyedb/__init__.py +1 -1
  2. pyedb/configuration/cfg_components.py +1 -1
  3. pyedb/configuration/cfg_ports_sources.py +3 -3
  4. pyedb/configuration/configuration.py +2 -2
  5. pyedb/dotnet/edb.py +55 -56
  6. pyedb/dotnet/edb_core/cell/hierarchy/component.py +1 -1
  7. pyedb/dotnet/edb_core/cell/hierarchy/hierarchy_obj.py +11 -0
  8. pyedb/dotnet/edb_core/cell/layout.py +30 -23
  9. pyedb/dotnet/edb_core/cell/layout_obj.py +0 -9
  10. pyedb/dotnet/edb_core/cell/primitive/__init__.py +3 -0
  11. pyedb/dotnet/edb_core/cell/{primitive.py → primitive/bondwire.py} +1 -146
  12. pyedb/dotnet/edb_core/cell/primitive/path.py +351 -0
  13. pyedb/dotnet/edb_core/cell/primitive/primitive.py +895 -0
  14. pyedb/dotnet/edb_core/cell/terminal/bundle_terminal.py +0 -4
  15. pyedb/dotnet/edb_core/cell/terminal/edge_terminal.py +1 -1
  16. pyedb/dotnet/edb_core/cell/terminal/terminal.py +1 -1
  17. pyedb/dotnet/edb_core/components.py +26 -18
  18. pyedb/dotnet/edb_core/dotnet/database.py +1 -23
  19. pyedb/dotnet/edb_core/dotnet/primitive.py +3 -139
  20. pyedb/dotnet/edb_core/edb_data/nets_data.py +1 -11
  21. pyedb/dotnet/edb_core/edb_data/padstacks_data.py +12 -38
  22. pyedb/dotnet/edb_core/edb_data/primitives_data.py +56 -868
  23. pyedb/dotnet/edb_core/edb_data/simulation_configuration.py +0 -18
  24. pyedb/dotnet/edb_core/geometry/polygon_data.py +43 -0
  25. pyedb/dotnet/edb_core/hfss.py +27 -23
  26. pyedb/dotnet/edb_core/layout_validation.py +3 -3
  27. pyedb/dotnet/edb_core/materials.py +1 -1
  28. pyedb/dotnet/edb_core/modeler.py +65 -82
  29. pyedb/dotnet/edb_core/nets.py +8 -7
  30. pyedb/dotnet/edb_core/padstack.py +16 -17
  31. pyedb/dotnet/edb_core/siwave.py +2 -2
  32. pyedb/dotnet/edb_core/stackup.py +64 -87
  33. pyedb/ipc2581/ecad/cad_data/layer_feature.py +1 -1
  34. pyedb/ipc2581/ecad/cad_data/polygon.py +2 -2
  35. pyedb/ipc2581/ecad/cad_data/step.py +3 -3
  36. pyedb/ipc2581/ipc2581.py +2 -2
  37. pyedb/siwave.py +99 -0
  38. {pyedb-0.22.1.dist-info → pyedb-0.24.0.dist-info}/METADATA +3 -3
  39. {pyedb-0.22.1.dist-info → pyedb-0.24.0.dist-info}/RECORD +41 -38
  40. {pyedb-0.22.1.dist-info → pyedb-0.24.0.dist-info}/LICENSE +0 -0
  41. {pyedb-0.22.1.dist-info → pyedb-0.24.0.dist-info}/WHEEL +0 -0
pyedb/__init__.py CHANGED
@@ -44,7 +44,7 @@ deprecation_warning()
44
44
  #
45
45
 
46
46
  pyedb_path = os.path.dirname(__file__)
47
- __version__ = "0.22.1"
47
+ __version__ = "0.24.0"
48
48
  version = __version__
49
49
 
50
50
  #
@@ -155,7 +155,7 @@ class CfgComponents:
155
155
  def _load_data_from_db(self):
156
156
  self.components = []
157
157
  comps_in_db = self._pedb.components
158
- for _, comp in comps_in_db.components.items():
158
+ for _, comp in comps_in_db.instances.items():
159
159
  cfg_comp = CfgComponent(
160
160
  enabled=comp.enabled,
161
161
  reference_designator=comp.name,
@@ -228,7 +228,7 @@ class CfgCircuitElement(CfgBase):
228
228
  neg_obj = self._create_pin_group(pins)
229
229
  pos_objs.update(neg_obj)
230
230
  elif pos_type == "pin":
231
- pins = {pos_value: self._pedb.components.components[self.reference_designator].pins[pos_value]}
231
+ pins = {pos_value: self._pedb.components.instances[self.reference_designator].pins[pos_value]}
232
232
  pos_objs.update(pins)
233
233
  else:
234
234
  raise f"Wrong positive terminal type {pos_type}"
@@ -263,7 +263,7 @@ class CfgCircuitElement(CfgBase):
263
263
  # create pin group
264
264
  neg_obj = self._create_pin_group(pins, True)
265
265
  elif neg_type == "pin":
266
- neg_obj = {neg_value: self._pedb.components.components[self.reference_designator].pins[neg_value]}
266
+ neg_obj = {neg_value: self._pedb.components.instances[self.reference_designator].pins[neg_value]}
267
267
  else:
268
268
  raise f"Wrong negative terminal type {neg_type}"
269
269
  self.neg_terminal = [
@@ -274,7 +274,7 @@ class CfgCircuitElement(CfgBase):
274
274
  terminal_value = terminal_value if isinstance(terminal_value, list) else [terminal_value]
275
275
 
276
276
  def get_pin_obj(pin_name):
277
- return {pin_name: self._pedb.components.components[self.reference_designator].pins[pin_name]}
277
+ return {pin_name: self._pedb.components.instances[self.reference_designator].pins[pin_name]}
278
278
 
279
279
  pins = dict()
280
280
  if terminal_type == "pin":
@@ -35,7 +35,7 @@ class Configuration:
35
35
 
36
36
  def __init__(self, pedb):
37
37
  self._pedb = pedb
38
- self._components = self._pedb.components.components
38
+ self._components = self._pedb.components.instances
39
39
  self.data = {}
40
40
  self._s_parameter_library = ""
41
41
  self._spice_model_library = ""
@@ -210,7 +210,7 @@ class Configuration:
210
210
 
211
211
  def _load_package_def(self):
212
212
  """Imports package definition information from JSON."""
213
- comps = self._pedb.components.components
213
+ comps = self._pedb.components.instances
214
214
  for pkgd in self.data["package_definitions"]:
215
215
  name = pkgd["name"]
216
216
  if name in self._pedb.definitions.package:
pyedb/dotnet/edb.py CHANGED
@@ -454,13 +454,13 @@ class Edb(Database):
454
454
  @property
455
455
  def excitations(self):
456
456
  """Get all layout excitations."""
457
- terms = [term for term in self.layout.terminals if int(term.GetBoundaryType()) == 0]
457
+ terms = [term for term in self.layout.terminals if int(term._edb_object.GetBoundaryType()) == 0]
458
458
  temp = {}
459
459
  for ter in terms:
460
- if "BundleTerminal" in ter.GetType().ToString():
461
- temp[ter.GetName()] = BundleWavePort(self, ter)
460
+ if "BundleTerminal" in ter._edb_object.GetType().ToString():
461
+ temp[ter.name] = BundleWavePort(self, ter._edb_object)
462
462
  else:
463
- temp[ter.GetName()] = GapPort(self, ter)
463
+ temp[ter.name] = GapPort(self, ter._edb_object)
464
464
  return temp
465
465
 
466
466
  @property
@@ -473,41 +473,41 @@ class Edb(Database):
473
473
  :class:`pyedb.dotnet.edb_core.edb_data.ports.WavePort`,]]
474
474
 
475
475
  """
476
- temp = [term for term in self.layout.terminals if not term.IsReferenceTerminal()]
476
+ temp = [term for term in self.layout.terminals if not term.is_reference_terminal]
477
477
 
478
478
  ports = {}
479
479
  for t in temp:
480
- t2 = Terminal(self, t)
480
+ t2 = Terminal(self, t._edb_object)
481
481
  if not t2.boundary_type == "PortBoundary":
482
482
  continue
483
483
 
484
484
  if t2.is_circuit_port:
485
- port = CircuitPort(self, t)
485
+ port = CircuitPort(self, t._edb_object)
486
486
  ports[port.name] = port
487
487
  elif t2.terminal_type == "BundleTerminal":
488
- port = BundleWavePort(self, t)
488
+ port = BundleWavePort(self, t._edb_object)
489
489
  ports[port.name] = port
490
490
  elif t2.hfss_type == "Wave":
491
- ports[t2.name] = WavePort(self, t)
491
+ ports[t2.name] = WavePort(self, t._edb_object)
492
492
  elif t2.terminal_type == "PadstackInstanceTerminal":
493
- ports[t2.name] = CoaxPort(self, t)
493
+ ports[t2.name] = CoaxPort(self, t._edb_object)
494
494
  else:
495
- ports[t2.name] = GapPort(self, t)
495
+ ports[t2.name] = GapPort(self, t._edb_object)
496
496
  return ports
497
497
 
498
498
  @property
499
499
  def excitations_nets(self):
500
500
  """Get all excitations net names."""
501
- names = list(set([i.GetNet().GetName() for i in self.layout.terminals]))
501
+ names = list(set([i.net.name for i in self.layout.terminals]))
502
502
  names = [i for i in names if i]
503
503
  return names
504
504
 
505
505
  @property
506
506
  def sources(self):
507
507
  """Get all layout sources."""
508
- terms = [term for term in self.layout.terminals if int(term.GetBoundaryType()) in [3, 4, 7]]
509
- terms = [term for term in terms if not term.IsReferenceTerminal()]
510
- return {ter.GetName(): ExcitationSources(self, ter) for ter in terms}
508
+ terms = [term for term in self.layout.terminals if int(term._edb_object.GetBoundaryType()) in [3, 4, 7]]
509
+ terms = [term for term in terms if not term._edb_object.IsReferenceTerminal()]
510
+ return {ter.name: ExcitationSources(self, ter._edb_object) for ter in terms}
511
511
 
512
512
  @property
513
513
  def voltage_regulator_modules(self):
@@ -1167,9 +1167,9 @@ class Edb(Database):
1167
1167
  elif obj_type == LayoutObjType.Primitive.name:
1168
1168
  prim_type = i.GetPrimitiveType().ToString()
1169
1169
  if prim_type == Primitives.Path.name:
1170
- from pyedb.dotnet.edb_core.edb_data.primitives_data import EdbPath
1170
+ from pyedb.dotnet.edb_core.cell.primitive.path import Path
1171
1171
 
1172
- temp.append(EdbPath(i, self))
1172
+ temp.append(Path(self, i))
1173
1173
  elif prim_type == Primitives.Rectangle.name:
1174
1174
  from pyedb.dotnet.edb_core.edb_data.primitives_data import (
1175
1175
  EdbRectangle,
@@ -1669,11 +1669,11 @@ class Edb(Database):
1669
1669
  from pyedb.dotnet.clr_module import Tuple
1670
1670
 
1671
1671
  _polys = []
1672
- terms = [term for term in self.layout.terminals if int(term.GetBoundaryType()) in [0, 3, 4, 7, 8]]
1672
+ terms = [term for term in self.layout.terminals if int(term._edb_object.GetBoundaryType()) in [0, 3, 4, 7, 8]]
1673
1673
  locations = []
1674
1674
  for term in terms:
1675
- if term.GetTerminalType().ToString() == "PointTerminal" and term.GetNet().GetName() in reference_list:
1676
- pd = term.GetParameters()[1]
1675
+ if term._edb_object.GetTerminalType().ToString() == "PointTerminal" and term.net.name in reference_list:
1676
+ pd = term._edb_object.GetParameters()[1]
1677
1677
  locations.append([pd.X.ToDouble(), pd.Y.ToDouble()])
1678
1678
  for point in locations:
1679
1679
  pointA = self.edb_api.geometry.point_data(
@@ -2214,11 +2214,13 @@ class Edb(Database):
2214
2214
  if pin.pingroups:
2215
2215
  pins_to_preserve.append(pin.id)
2216
2216
  if check_terminals:
2217
- terms = [term for term in self.layout.terminals if int(term.GetBoundaryType()) in [0, 3, 4, 7, 8]]
2217
+ terms = [
2218
+ term for term in self.layout.terminals if int(term._edb_object.GetBoundaryType()) in [0, 3, 4, 7, 8]
2219
+ ]
2218
2220
  for term in terms:
2219
- if term.GetTerminalType().ToString() == "PadstackInstanceTerminal":
2220
- if term.GetParameters()[1].GetNet().GetName() in reference_list:
2221
- pins_to_preserve.append(term.GetParameters()[1].GetId())
2221
+ if term._edb_object.GetTerminalType().ToString() == "PadstackInstanceTerminal":
2222
+ if term._edb_object.GetParameters()[1].GetNet().GetName() in reference_list:
2223
+ pins_to_preserve.append(term._edb_object.GetParameters()[1].GetId())
2222
2224
 
2223
2225
  for i in self.nets.nets.values():
2224
2226
  name = i.name
@@ -2309,7 +2311,7 @@ class Edb(Database):
2309
2311
  return poly.Subtract(convert_py_list_to_net_list(poly), convert_py_list_to_net_list(voids))
2310
2312
 
2311
2313
  def clip_path(path):
2312
- pdata = path.polygon_data.edb_api
2314
+ pdata = path.polygon_data._edb_object
2313
2315
  int_data = _poly.GetIntersectionType(pdata)
2314
2316
  if int_data == 0:
2315
2317
  prims_to_delete.append(path)
@@ -2320,7 +2322,7 @@ class Edb(Database):
2320
2322
  reference_prims.append(path)
2321
2323
 
2322
2324
  def clean_prim(prim_1): # pragma: no cover
2323
- pdata = prim_1.polygon_data.edb_api
2325
+ pdata = prim_1.polygon_data._edb_object
2324
2326
  int_data = _poly.GetIntersectionType(pdata)
2325
2327
  if int_data == 2:
2326
2328
  if not inlcude_voids_in_extents:
@@ -2347,7 +2349,7 @@ class Edb(Database):
2347
2349
  # points = list(p.Points)
2348
2350
  list_void = []
2349
2351
  if voids:
2350
- voids_data = [void.polygon_data.edb_api for void in voids]
2352
+ voids_data = [void.polygon_data._edb_object for void in voids]
2351
2353
  list_prims = subtract(p, voids_data)
2352
2354
  for prim in list_prims:
2353
2355
  if not prim.IsNull():
@@ -2396,7 +2398,7 @@ class Edb(Database):
2396
2398
  self.logger.reset_timer()
2397
2399
 
2398
2400
  i = 0
2399
- for _, val in self.components.components.items():
2401
+ for _, val in self.components.instances.items():
2400
2402
  if val.numpins == 0:
2401
2403
  val.edbcomponent.Delete()
2402
2404
  i += 1
@@ -2580,28 +2582,6 @@ class Edb(Database):
2580
2582
  else:
2581
2583
  return "{0}{1}".format(value, units)
2582
2584
 
2583
- def arg_with_dim(self, Value, sUnits):
2584
- """Convert a number to a string with units. If value is a string, it's returned as is.
2585
-
2586
- .. deprecated:: 0.6.56
2587
- Use :func:`number_with_units` property instead.
2588
-
2589
- Parameters
2590
- ----------
2591
- Value : float, int, str
2592
- Input number or string.
2593
- sUnits : optional
2594
- Units for formatting. The default is ``None``, which uses ``"meter"``.
2595
-
2596
- Returns
2597
- -------
2598
- str
2599
- String concatenating the value and unit.
2600
-
2601
- """
2602
- warnings.warn("Use :func:`number_with_units` instead.", DeprecationWarning)
2603
- return self.number_with_units(Value, sUnits)
2604
-
2605
2585
  def _decompose_variable_value(self, value, unit_system=None):
2606
2586
  val, units = decompose_variable_value(value)
2607
2587
  if units and unit_system and units in AEDT_UNITS[unit_system]:
@@ -4128,6 +4108,7 @@ class Edb(Database):
4128
4108
  open_aedb_at_end=True,
4129
4109
  expand_polygons_size=0,
4130
4110
  expand_voids_size=0,
4111
+ via_offset=True,
4131
4112
  ):
4132
4113
  """Assign automatically design and project variables with current values.
4133
4114
 
@@ -4163,6 +4144,12 @@ class Edb(Database):
4163
4144
  Full path and name for the new AEDB file. If None, then current aedb will be cutout.
4164
4145
  open_aedb_at_end : bool, optional
4165
4146
  Whether to open the cutout at the end. The default is ``True``.
4147
+ expand_polygons_size : float, optional
4148
+ Expansion size on polygons. Polygons will be expanded in all directions. The default is ``0``.
4149
+ expand_voids_size : float, optional
4150
+ Expansion size on polygon voids. Polygons voids will be expanded in all directions. The default is ``0``.
4151
+ via_offset : bool, optional
4152
+ Whether if offset the via position or not. The default is ``True``.
4166
4153
 
4167
4154
  Returns
4168
4155
  -------
@@ -4326,6 +4313,18 @@ class Edb(Database):
4326
4313
  antipad.parameters = {"XSize": var, "YSize": var2}
4327
4314
  parameters.append(val)
4328
4315
  parameters.append(val2)
4316
+
4317
+ if via_offset:
4318
+ var_x = "via_offset_x"
4319
+ if var_x not in self.variables:
4320
+ self.add_design_variable(var_x, 0.0)
4321
+ var_y = "via_offset_y"
4322
+ if var_y not in self.variables:
4323
+ self.add_design_variable(var_y, 0.0)
4324
+ for via in self.padstacks.instances.values():
4325
+ if not via.is_pin and (not trace_net_filter or (trace_net_filter and via.net_name in trace_net_filter)):
4326
+ via.position = [f"{via.position[0]}+via_offset_x", f"{via.position[1]}+via_offset_y"]
4327
+
4329
4328
  if expand_polygons_size:
4330
4329
  for poly in self.modeler.polygons:
4331
4330
  if not poly.is_void:
@@ -4448,10 +4447,10 @@ class Edb(Database):
4448
4447
  for poly in polys:
4449
4448
  for void in poly.voids:
4450
4449
  void_bbox = (
4451
- void.polygon_data.edb_api.GetBBox().Item1.X.ToDouble(),
4452
- void.polygon_data.edb_api.GetBBox().Item1.Y.ToDouble(),
4453
- void.polygon_data.edb_api.GetBBox().Item2.X.ToDouble(),
4454
- void.polygon_data.edb_api.GetBBox().Item2.Y.ToDouble(),
4450
+ void.polygon_data._edb_object.GetBBox().Item1.X.ToDouble(),
4451
+ void.polygon_data._edb_object.GetBBox().Item1.Y.ToDouble(),
4452
+ void.polygon_data._edb_object.GetBBox().Item2.X.ToDouble(),
4453
+ void.polygon_data._edb_object.GetBBox().Item2.Y.ToDouble(),
4455
4454
  )
4456
4455
  included_instances = list(padstack_instances_index.intersection(void_bbox))
4457
4456
  if included_instances:
@@ -4484,10 +4483,10 @@ class Edb(Database):
4484
4483
 
4485
4484
  for void_info in void_padstacks:
4486
4485
  port_poly = cloned_edb.modeler.create_polygon(
4487
- main_shape=void_info[0].polygon_data.edb_api, layer_name="ref", net_name="GND"
4486
+ main_shape=void_info[0].polygon_data._edb_object, layer_name="ref", net_name="GND"
4488
4487
  )
4489
4488
  pec_poly = cloned_edb.modeler.create_polygon(
4490
- main_shape=port_poly.polygon_data.edb_api, layer_name="port_pec", net_name="GND"
4489
+ main_shape=port_poly.polygon_data._edb_object, layer_name="port_pec", net_name="GND"
4491
4490
  )
4492
4491
  pec_poly.scale(1.5)
4493
4492
 
@@ -958,7 +958,7 @@ class EDBComponent(Group):
958
958
  opening.append(bounding_box[3] + extra_soldermask_clearance)
959
959
 
960
960
  comp_layer = self.placement_layer
961
- layer_names = list(self._pedb.stackup.stackup_layers.keys())
961
+ layer_names = list(self._pedb.stackup.layers.keys())
962
962
  layer_index = layer_names.index(comp_layer)
963
963
  if comp_layer in [layer_names[0] + layer_names[-1]]:
964
964
  return False
@@ -48,3 +48,14 @@ class HierarchyObj(Connectable):
48
48
  class Group(HierarchyObj):
49
49
  def __init__(self, pedb, edb_object):
50
50
  super().__init__(pedb, edb_object)
51
+
52
+ def ungroup(self, recursive=False):
53
+ """Dissolve a group.
54
+
55
+ Parameters
56
+ ----------
57
+ recursive : bool, optional
58
+ If True, all subgroups will also be dissolved.
59
+
60
+ """
61
+ return self._edb_object.Ungroup(recursive)
@@ -24,7 +24,8 @@
24
24
  This module contains these classes: `EdbLayout` and `Shape`.
25
25
  """
26
26
  from pyedb.dotnet.edb_core.cell.hierarchy.component import EDBComponent
27
- from pyedb.dotnet.edb_core.cell.primitive import Bondwire
27
+ from pyedb.dotnet.edb_core.cell.primitive.bondwire import Bondwire
28
+ from pyedb.dotnet.edb_core.cell.primitive.path import Path
28
29
  from pyedb.dotnet.edb_core.cell.terminal.bundle_terminal import BundleTerminal
29
30
  from pyedb.dotnet.edb_core.cell.terminal.edge_terminal import EdgeTerminal
30
31
  from pyedb.dotnet.edb_core.cell.terminal.padstack_instance_terminal import (
@@ -42,7 +43,6 @@ from pyedb.dotnet.edb_core.edb_data.nets_data import (
42
43
  from pyedb.dotnet.edb_core.edb_data.padstacks_data import EDBPadstackInstance
43
44
  from pyedb.dotnet.edb_core.edb_data.primitives_data import (
44
45
  EdbCircle,
45
- EdbPath,
46
46
  EdbPolygon,
47
47
  EdbRectangle,
48
48
  EdbText,
@@ -206,26 +206,8 @@ class Layout(ObjBase):
206
206
  """
207
207
  prims = []
208
208
  for p in self._edb_object.Primitives:
209
- if p.GetPrimitiveType().ToString() == "Rectangle":
210
- prims.append(EdbRectangle(p, self._pedb))
211
- elif p.GetPrimitiveType().ToString() == "Circle":
212
- prims.append(EdbCircle(p, self._pedb))
213
- elif p.GetPrimitiveType().ToString() == "Polygon":
214
- prims.append(EdbPolygon(p, self._pedb))
215
- elif p.GetPrimitiveType().ToString() == "Path":
216
- prims.append(EdbPath(p, self._pedb))
217
- elif p.GetPrimitiveType().ToString() == "Bondwire":
218
- prims.append(Bondwire(self._pedb, p))
219
- elif p.GetPrimitiveType().ToString() == "Text":
220
- prims.append(EdbText(p, self._pedb))
221
- elif p.GetPrimitiveType().ToString() == "PrimitivePlugin":
222
- pass
223
- elif p.GetPrimitiveType().ToString() == "Path3D":
224
- pass
225
- elif p.GetPrimitiveType().ToString() == "BoardBendDef":
226
- pass
227
- else:
228
- pass
209
+ obj = self.find_object_by_id(p.GetId())
210
+ prims.append(obj)
229
211
  return prims
230
212
 
231
213
  @property
@@ -293,8 +275,33 @@ class Layout(ObjBase):
293
275
  ID of the object.
294
276
  """
295
277
  obj = self._pedb._edb.Cell.Connectable.FindById(self._edb_object, value)
278
+ if obj is None:
279
+ raise RuntimeError(f"Object Id {value} not found")
280
+
296
281
  if obj.GetObjType().ToString() == "PadstackInstance":
297
- return EDBPadstackInstance(obj, self._pedb) if obj is not None else None
282
+ return EDBPadstackInstance(obj, self._pedb)
283
+
284
+ if obj.GetObjType().ToString() == "Primitive":
285
+ if obj.GetPrimitiveType().ToString() == "Rectangle":
286
+ return EdbRectangle(obj, self._pedb)
287
+ elif obj.GetPrimitiveType().ToString() == "Circle":
288
+ return EdbCircle(obj, self._pedb)
289
+ elif obj.GetPrimitiveType().ToString() == "Polygon":
290
+ return EdbPolygon(obj, self._pedb)
291
+ elif obj.GetPrimitiveType().ToString() == "Path":
292
+ return Path(self._pedb, obj)
293
+ elif obj.GetPrimitiveType().ToString() == "Bondwire":
294
+ return Bondwire(self._pedb, obj)
295
+ elif obj.GetPrimitiveType().ToString() == "Text":
296
+ return EdbText(obj, self._pedb)
297
+ elif obj.GetPrimitiveType().ToString() == "PrimitivePlugin":
298
+ pass
299
+ elif obj.GetPrimitiveType().ToString() == "Path3D":
300
+ pass
301
+ elif obj.GetPrimitiveType().ToString() == "BoardBendDef":
302
+ pass
303
+ else:
304
+ pass
298
305
 
299
306
  def find_net_by_name(self, value: str):
300
307
  """Find a net object by name
@@ -27,15 +27,6 @@ from pyedb.dotnet.edb_core.utilities.obj_base import ObjBase
27
27
  class LayoutObj(ObjBase):
28
28
  """Manages EDB functionalities for the layout object."""
29
29
 
30
- def __getattr__(self, key): # pragma: no cover
31
- try:
32
- return super().__getattribute__(key)
33
- except AttributeError:
34
- try:
35
- return getattr(self._edb_object, key)
36
- except AttributeError:
37
- raise AttributeError(f"Attribute '{key}' not present")
38
-
39
30
  def __init__(self, pedb, edb_object):
40
31
  super().__init__(pedb, edb_object)
41
32
 
@@ -0,0 +1,3 @@
1
+ from pathlib import Path
2
+
3
+ workdir = Path(__file__).parent
@@ -20,152 +20,7 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
- from pyedb.dotnet.edb_core.cell.connectable import Connectable
24
-
25
-
26
- class Primitive(Connectable):
27
- """Manages EDB functionalities for a primitives.
28
- It inherits EDB Object properties.
29
-
30
- Examples
31
- --------
32
- >>> from pyedb import Edb
33
- >>> edb = Edb(myedb, edbversion="2021.2")
34
- >>> edb_prim = edb.modeler.primitives[0]
35
- >>> edb_prim.is_void # Class Property
36
- >>> edb_prim.IsVoid() # EDB Object Property
37
- """
38
-
39
- def __init__(self, pedb, edb_object):
40
- super().__init__(pedb, edb_object)
41
- self._app = self._pedb
42
- self._core_stackup = pedb.stackup
43
- self._core_net = pedb.nets
44
- self.primitive_object = self._edb_object
45
-
46
- bondwire_type = self._pedb._edb.Cell.Primitive.BondwireType
47
- self._bondwire_type = {
48
- "invalid": bondwire_type.Invalid,
49
- "apd": bondwire_type.ApdBondwire,
50
- "jedec_4": bondwire_type.Jedec4Bondwire,
51
- "jedec_5": bondwire_type.Jedec5Bondwire,
52
- "num_of_bondwire_type": bondwire_type.NumOfBondwireType,
53
- }
54
- bondwire_cross_section_type = self._pedb._edb.Cell.Primitive.BondwireCrossSectionType
55
- self._bondwire_cross_section_type = {
56
- "invalid": bondwire_cross_section_type.Invalid,
57
- "round": bondwire_cross_section_type.BondwireRound,
58
- "rectangle": bondwire_cross_section_type.BondwireRectangle,
59
- }
60
-
61
- @property
62
- def type(self):
63
- """Return the type of the primitive.
64
-
65
- Expected output is among ``"Circle"``, ``"Rectangle"``,``"Polygon"``,``"Path"`` or ``"Bondwire"``.
66
-
67
- Returns
68
- -------
69
- str
70
- """
71
- try:
72
- return self._edb_object.GetPrimitiveType().ToString()
73
- except AttributeError: # pragma: no cover
74
- return ""
75
-
76
- @property
77
- def primitive_type(self):
78
- """Return the type of the primitive.
79
-
80
- Expected output is among ``"circle"``, ``"rectangle"``,``"polygon"``,``"path"`` or ``"bondwire"``.
81
-
82
- Returns
83
- -------
84
- str
85
- """
86
- return self._edb_object.GetPrimitiveType().ToString().lower()
87
-
88
- @property
89
- def net_name(self):
90
- """Get the primitive net name.
91
-
92
- Returns
93
- -------
94
- str
95
- """
96
- return self.net.GetName()
97
-
98
- @net_name.setter
99
- def net_name(self, name):
100
- if isinstance(name, str):
101
- net = self._app.nets.nets[name].net_object
102
- self.primitive_object.SetNet(net)
103
- else:
104
- try:
105
- self.net = name.name
106
- except: # pragma: no cover
107
- self._app.logger.error("Failed to set net name.")
108
-
109
- @property
110
- def layer(self):
111
- """Get the primitive edb layer object."""
112
- try:
113
- layer_name = self.primitive_object.GetLayer().GetName()
114
- return self._pedb.stackup.layers[layer_name]
115
- except (KeyError, AttributeError): # pragma: no cover
116
- return None
117
-
118
- @property
119
- def layer_name(self):
120
- """Get the primitive layer name.
121
-
122
- Returns
123
- -------
124
- str
125
- """
126
- try:
127
- return self.layer.name
128
- except (KeyError, AttributeError): # pragma: no cover
129
- return None
130
-
131
- @layer_name.setter
132
- def layer_name(self, val):
133
- layer_list = list(self._core_stackup.layers.keys())
134
- if isinstance(val, str) and val in layer_list:
135
- layer = self._core_stackup.layers[val]._edb_layer
136
- if layer:
137
- self.primitive_object.SetLayer(layer)
138
- else:
139
- raise AttributeError("Layer {} not found.".format(val))
140
- elif isinstance(val, type(self._core_stackup.layers[layer_list[0]])):
141
- try:
142
- self.primitive_object.SetLayer(val._edb_layer)
143
- except:
144
- raise AttributeError("Failed to assign new layer on primitive.")
145
- else:
146
- raise AttributeError("Invalid input value")
147
-
148
- @property
149
- def is_void(self):
150
- """Either if the primitive is a void or not.
151
-
152
- Returns
153
- -------
154
- bool
155
- """
156
- try:
157
- return self._edb_object.IsVoid()
158
- except AttributeError: # pragma: no cover
159
- return None
160
-
161
- def get_connected_objects(self):
162
- """Get connected objects.
163
-
164
- Returns
165
- -------
166
- list
167
- """
168
- return self._pedb.get_connected_objects(self._layout_obj_instance)
23
+ from pyedb.dotnet.edb_core.cell.primitive.primitive import Primitive
169
24
 
170
25
 
171
26
  class Bondwire(Primitive):