pyedb 0.53.0__py3-none-any.whl → 0.55.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 (119) hide show
  1. pyedb/__init__.py +1 -8
  2. pyedb/configuration/cfg_boundaries.py +69 -151
  3. pyedb/configuration/cfg_components.py +201 -460
  4. pyedb/configuration/cfg_data.py +4 -2
  5. pyedb/configuration/cfg_general.py +13 -36
  6. pyedb/configuration/cfg_modeler.py +2 -1
  7. pyedb/configuration/cfg_nets.py +21 -35
  8. pyedb/configuration/cfg_operations.py +22 -151
  9. pyedb/configuration/cfg_package_definition.py +56 -112
  10. pyedb/configuration/cfg_padstacks.py +292 -688
  11. pyedb/configuration/cfg_pin_groups.py +32 -79
  12. pyedb/configuration/cfg_ports_sources.py +20 -9
  13. pyedb/configuration/cfg_s_parameter_models.py +67 -172
  14. pyedb/configuration/cfg_setup.py +102 -295
  15. pyedb/configuration/configuration.py +66 -6
  16. pyedb/dotnet/database/cell/connectable.py +38 -9
  17. pyedb/dotnet/database/cell/hierarchy/component.py +28 -28
  18. pyedb/dotnet/database/cell/hierarchy/model.py +1 -1
  19. pyedb/dotnet/database/cell/layout.py +64 -3
  20. pyedb/dotnet/database/cell/layout_obj.py +3 -3
  21. pyedb/dotnet/database/cell/primitive/path.py +6 -8
  22. pyedb/dotnet/database/cell/primitive/primitive.py +10 -31
  23. pyedb/dotnet/database/cell/terminal/edge_terminal.py +2 -2
  24. pyedb/dotnet/database/cell/terminal/padstack_instance_terminal.py +1 -1
  25. pyedb/dotnet/database/cell/terminal/pingroup_terminal.py +1 -1
  26. pyedb/dotnet/database/cell/terminal/point_terminal.py +1 -1
  27. pyedb/dotnet/database/cell/terminal/terminal.py +26 -28
  28. pyedb/dotnet/database/cell/voltage_regulator.py +0 -21
  29. pyedb/dotnet/database/components.py +99 -91
  30. pyedb/dotnet/database/definition/component_def.py +4 -4
  31. pyedb/dotnet/database/definition/component_model.py +1 -1
  32. pyedb/dotnet/database/definition/package_def.py +2 -3
  33. pyedb/dotnet/database/dotnet/database.py +27 -218
  34. pyedb/dotnet/database/dotnet/primitive.py +16 -16
  35. pyedb/dotnet/database/edb_data/control_file.py +5 -5
  36. pyedb/dotnet/database/edb_data/hfss_extent_info.py +6 -6
  37. pyedb/dotnet/database/edb_data/layer_data.py +35 -35
  38. pyedb/dotnet/database/edb_data/padstacks_data.py +65 -90
  39. pyedb/dotnet/database/edb_data/primitives_data.py +5 -5
  40. pyedb/dotnet/database/edb_data/sources.py +6 -6
  41. pyedb/dotnet/database/edb_data/variables.py +8 -4
  42. pyedb/dotnet/database/geometry/point_data.py +14 -10
  43. pyedb/dotnet/database/geometry/polygon_data.py +3 -5
  44. pyedb/dotnet/database/hfss.py +50 -52
  45. pyedb/dotnet/database/layout_validation.py +14 -11
  46. pyedb/dotnet/database/materials.py +10 -11
  47. pyedb/dotnet/database/modeler.py +104 -101
  48. pyedb/dotnet/database/nets.py +20 -23
  49. pyedb/dotnet/database/padstack.py +156 -84
  50. pyedb/dotnet/database/sim_setup_data/data/settings.py +24 -0
  51. pyedb/dotnet/database/sim_setup_data/io/siwave.py +26 -1
  52. pyedb/dotnet/database/siwave.py +47 -47
  53. pyedb/dotnet/database/stackup.py +152 -87
  54. pyedb/dotnet/database/utilities/heatsink.py +4 -4
  55. pyedb/dotnet/database/utilities/obj_base.py +3 -3
  56. pyedb/dotnet/database/utilities/simulation_setup.py +2 -2
  57. pyedb/dotnet/database/utilities/value.py +116 -0
  58. pyedb/dotnet/edb.py +248 -170
  59. pyedb/edb_logger.py +12 -27
  60. pyedb/extensions/via_design_backend.py +6 -3
  61. pyedb/generic/design_types.py +68 -21
  62. pyedb/generic/general_methods.py +0 -120
  63. pyedb/generic/process.py +44 -108
  64. pyedb/generic/settings.py +75 -19
  65. pyedb/grpc/__init__.py +0 -0
  66. pyedb/grpc/database/components.py +55 -17
  67. pyedb/grpc/database/control_file.py +5 -5
  68. pyedb/grpc/database/definition/materials.py +24 -31
  69. pyedb/grpc/database/definition/package_def.py +18 -18
  70. pyedb/grpc/database/definition/padstack_def.py +104 -51
  71. pyedb/grpc/database/geometry/arc_data.py +7 -5
  72. pyedb/grpc/database/geometry/point_3d_data.py +8 -7
  73. pyedb/grpc/database/geometry/polygon_data.py +4 -3
  74. pyedb/grpc/database/hierarchy/component.py +43 -38
  75. pyedb/grpc/database/hierarchy/pin_pair_model.py +15 -14
  76. pyedb/grpc/database/hierarchy/pingroup.py +9 -9
  77. pyedb/grpc/database/layers/stackup_layer.py +45 -44
  78. pyedb/grpc/database/layout/layout.py +17 -13
  79. pyedb/grpc/database/layout/voltage_regulator.py +7 -7
  80. pyedb/grpc/database/layout_validation.py +16 -15
  81. pyedb/grpc/database/modeler.py +60 -58
  82. pyedb/grpc/database/net/net.py +15 -14
  83. pyedb/grpc/database/nets.py +112 -31
  84. pyedb/grpc/database/padstacks.py +303 -190
  85. pyedb/grpc/database/ports/ports.py +5 -6
  86. pyedb/grpc/database/primitive/bondwire.py +8 -7
  87. pyedb/grpc/database/primitive/circle.py +4 -4
  88. pyedb/grpc/database/primitive/padstack_instance.py +191 -23
  89. pyedb/grpc/database/primitive/path.py +7 -7
  90. pyedb/grpc/database/primitive/polygon.py +3 -3
  91. pyedb/grpc/database/primitive/primitive.py +13 -17
  92. pyedb/grpc/database/primitive/rectangle.py +13 -13
  93. pyedb/grpc/database/simulation_setup/hfss_general_settings.py +1 -1
  94. pyedb/grpc/database/simulation_setup/hfss_simulation_setup.py +10 -0
  95. pyedb/grpc/database/simulation_setup/siwave_simulation_setup.py +17 -1
  96. pyedb/grpc/database/siwave.py +31 -25
  97. pyedb/grpc/database/source_excitations.py +335 -233
  98. pyedb/grpc/database/stackup.py +165 -148
  99. pyedb/grpc/database/terminal/bundle_terminal.py +18 -8
  100. pyedb/grpc/database/terminal/edge_terminal.py +10 -0
  101. pyedb/grpc/database/terminal/padstack_instance_terminal.py +16 -5
  102. pyedb/grpc/database/terminal/pingroup_terminal.py +12 -11
  103. pyedb/grpc/database/terminal/point_terminal.py +4 -3
  104. pyedb/grpc/database/terminal/terminal.py +9 -9
  105. pyedb/grpc/database/utility/value.py +109 -0
  106. pyedb/grpc/database/utility/xml_control_file.py +5 -5
  107. pyedb/grpc/edb.py +130 -63
  108. pyedb/grpc/edb_init.py +3 -10
  109. pyedb/grpc/rpc_session.py +10 -10
  110. pyedb/libraries/common.py +366 -0
  111. pyedb/libraries/rf_libraries/base_functions.py +1358 -0
  112. pyedb/libraries/rf_libraries/planar_antennas.py +628 -0
  113. pyedb/misc/decorators.py +61 -0
  114. pyedb/misc/misc.py +0 -13
  115. pyedb/siwave.py +2 -2
  116. {pyedb-0.53.0.dist-info → pyedb-0.55.0.dist-info}/METADATA +2 -3
  117. {pyedb-0.53.0.dist-info → pyedb-0.55.0.dist-info}/RECORD +119 -112
  118. {pyedb-0.53.0.dist-info → pyedb-0.55.0.dist-info}/WHEEL +0 -0
  119. {pyedb-0.53.0.dist-info → pyedb-0.55.0.dist-info}/licenses/LICENSE +0 -0
@@ -40,7 +40,6 @@ from ansys.edb.core.primitive.path import PathEndCapType as GrpcPathEndCapType
40
40
  from ansys.edb.core.primitive.rectangle import (
41
41
  RectangleRepresentationType as GrpcRectangleRepresentationType,
42
42
  )
43
- from ansys.edb.core.utility.value import Value as GrpcValue
44
43
 
45
44
  from pyedb.grpc.database.primitive.bondwire import Bondwire
46
45
  from pyedb.grpc.database.primitive.circle import Circle
@@ -49,6 +48,7 @@ from pyedb.grpc.database.primitive.polygon import Polygon
49
48
  from pyedb.grpc.database.primitive.primitive import Primitive
50
49
  from pyedb.grpc.database.primitive.rectangle import Rectangle
51
50
  from pyedb.grpc.database.utility.layout_statistics import LayoutStatistics
51
+ from pyedb.grpc.database.utility.value import Value
52
52
 
53
53
 
54
54
  class Modeler(object):
@@ -92,7 +92,8 @@ class Modeler(object):
92
92
  def __init__(self, p_edb) -> None:
93
93
  """Initialize Modeler instance."""
94
94
  self._pedb = p_edb
95
- self._primitives = []
95
+ self.__primitives = []
96
+ self.__primitives_by_layer = {}
96
97
 
97
98
  @property
98
99
  def _edb(self) -> Any:
@@ -219,7 +220,7 @@ class Modeler(object):
219
220
  list
220
221
  List of :class:`pyedb.dotnet.database.edb_data.primitives_data.Primitive` objects.
221
222
  """
222
- return [self.__mapping_primitive_type(prim) for prim in self._pedb.layout.primitives]
223
+ return self._pedb.layout.primitives
223
224
 
224
225
  @property
225
226
  def polygons_by_layer(self) -> Dict[str, List[Primitive]]:
@@ -267,7 +268,7 @@ class Modeler(object):
267
268
  try:
268
269
  lay = i.layer.name
269
270
  if lay in _primitives_by_layer:
270
- _primitives_by_layer[lay].append(Primitive(self._pedb, i))
271
+ _primitives_by_layer[lay].append(i)
271
272
  except (InvalidArgumentException, AttributeError):
272
273
  pass
273
274
  return _primitives_by_layer
@@ -425,12 +426,7 @@ class Modeler(object):
425
426
  Bounding box coordinates [min_x, min_y, max_x, max_y].
426
427
  """
427
428
  bounding_box = polygon.polygon_data.bbox()
428
- return [
429
- bounding_box[0].x.value,
430
- bounding_box[0].y.value,
431
- bounding_box[1].x.value,
432
- bounding_box[1].y.value,
433
- ]
429
+ return [Value(bounding_box[0].x), Value(bounding_box[0].y), Value(bounding_box[1].x), Value(bounding_box[1].y)]
434
430
 
435
431
  @staticmethod
436
432
  def get_polygon_points(polygon) -> List[List[float]]:
@@ -455,9 +451,9 @@ class Modeler(object):
455
451
  point = polygon.polygon_data.points[i]
456
452
  if prev_point != point:
457
453
  if point.is_arc:
458
- points.append([point.x.value])
454
+ points.append([Value(point.x)])
459
455
  else:
460
- points.append([point.x.value, point.y.value])
456
+ points.append([Value(point.x), Value(point.y)])
461
457
  prev_point = point
462
458
  i += 1
463
459
  else:
@@ -513,8 +509,8 @@ class Modeler(object):
513
509
  polygon_data = polygon.polygon_data
514
510
  bound_center = polygon_data.bounding_circle()[0]
515
511
  bound_center2 = selection_polygon_data.bounding_circle()[0]
516
- center = [bound_center.x.value, bound_center.y.value]
517
- center2 = [bound_center2.x.value, bound_center2.y.value]
512
+ center = [Value(bound_center.x), Value(bound_center.y)]
513
+ center2 = [Value(bound_center2.x), Value(bound_center2.y)]
518
514
  x1, y1 = calc_slope(center2, center)
519
515
 
520
516
  if not origin:
@@ -529,12 +525,12 @@ class Modeler(object):
529
525
  if prev_point != point:
530
526
  check_inside = selection_polygon_data.is_inside(point)
531
527
  if check_inside:
532
- xcoeff, ycoeff = calc_slope([point.x.value, point.x.value], origin)
528
+ xcoeff, ycoeff = calc_slope([Value(point.x), Value(point.x)], origin)
533
529
 
534
530
  new_points = GrpcPointData(
535
531
  [
536
- GrpcValue(str(point.x.value) + f"{xcoeff}*{offset_name}"),
537
- GrpcValue(str(point.y.value) + f"{ycoeff}*{offset_name}"),
532
+ Value(str(Value(point.x) + f"{xcoeff}*{offset_name}")),
533
+ Value(str(Value(point.y)) + f"{ycoeff}*{offset_name}"),
538
534
  ]
539
535
  )
540
536
  polygon_data.points[i] = new_points
@@ -610,12 +606,12 @@ class Modeler(object):
610
606
  for pt in points:
611
607
  _pt = []
612
608
  for coord in pt:
613
- coord = GrpcValue(coord, self._pedb.active_cell)
609
+ coord = Value(coord, self._pedb.active_cell)
614
610
  _pt.append(coord)
615
611
  _points.append(_pt)
616
612
  points = _points
617
613
 
618
- width = GrpcValue(width, self._pedb.active_cell)
614
+ width = Value(width, self._pedb.active_cell)
619
615
 
620
616
  polygon_data = GrpcPolygonData(points=[GrpcPointData(i) for i in points])
621
617
  path = Path.create(
@@ -710,7 +706,7 @@ class Modeler(object):
710
706
  new_points = []
711
707
  for idx, i in enumerate(points):
712
708
  new_points.append(
713
- GrpcPointData([GrpcValue(i[0], self._pedb.active_cell), GrpcValue(i[1], self._pedb.active_cell)])
709
+ GrpcPointData([Value(i[0], self._pedb.active_cell), Value(i[1], self._pedb.active_cell)])
714
710
  )
715
711
  polygon_data = GrpcPolygonData(points=new_points)
716
712
 
@@ -787,40 +783,40 @@ class Modeler(object):
787
783
  layer=layer_name,
788
784
  net=edb_net,
789
785
  rep_type=rep_type,
790
- param1=GrpcValue(lower_left_point[0]),
791
- param2=GrpcValue(lower_left_point[1]),
792
- param3=GrpcValue(upper_right_point[0]),
793
- param4=GrpcValue(upper_right_point[1]),
794
- corner_rad=GrpcValue(corner_radius),
795
- rotation=GrpcValue(rotation),
786
+ param1=Value(lower_left_point[0]),
787
+ param2=Value(lower_left_point[1]),
788
+ param3=Value(upper_right_point[0]),
789
+ param4=Value(upper_right_point[1]),
790
+ corner_rad=Value(corner_radius),
791
+ rotation=Value(rotation),
796
792
  )
797
793
  else:
798
794
  rep_type = GrpcRectangleRepresentationType.CENTER_WIDTH_HEIGHT
799
795
  if isinstance(width, str):
800
796
  if width in self._pedb.variables:
801
- width = GrpcValue(width, self._pedb.active_cell)
797
+ width = Value(width, self._pedb.active_cell)
802
798
  else:
803
- width = GrpcValue(width)
799
+ width = Value(width)
804
800
  else:
805
- width = GrpcValue(width)
801
+ width = Value(width)
806
802
  if isinstance(height, str):
807
803
  if height in self._pedb.variables:
808
- height = GrpcValue(height, self._pedb.active_cell)
804
+ height = Value(height, self._pedb.active_cell)
809
805
  else:
810
- height = GrpcValue(width)
806
+ height = Value(width)
811
807
  else:
812
- height = GrpcValue(width)
808
+ height = Value(width)
813
809
  rect = Rectangle.create(
814
810
  layout=self._active_layout,
815
811
  layer=layer_name,
816
812
  net=edb_net,
817
813
  rep_type=rep_type,
818
- param1=GrpcValue(center_point[0]),
819
- param2=GrpcValue(center_point[1]),
820
- param3=GrpcValue(width),
821
- param4=GrpcValue(height),
822
- corner_rad=GrpcValue(corner_radius),
823
- rotation=GrpcValue(rotation),
814
+ param1=Value(center_point[0]),
815
+ param2=Value(center_point[1]),
816
+ param3=Value(width),
817
+ param4=Value(height),
818
+ corner_rad=Value(corner_radius),
819
+ rotation=Value(rotation),
824
820
  )
825
821
  if not rect.is_null:
826
822
  return Rectangle(self._pedb, rect)
@@ -855,9 +851,9 @@ class Modeler(object):
855
851
  layout=self._active_layout,
856
852
  layer=layer_name,
857
853
  net=edb_net,
858
- center_x=GrpcValue(x),
859
- center_y=GrpcValue(y),
860
- radius=GrpcValue(radius),
854
+ center_x=Value(x),
855
+ center_y=Value(y),
856
+ radius=Value(radius),
861
857
  )
862
858
  if not circle.is_null:
863
859
  return Circle(self._pedb, circle)
@@ -944,9 +940,9 @@ class Modeler(object):
944
940
  layout=self._active_layout,
945
941
  layer=void_circle.layer_name,
946
942
  net=void_circle.net,
947
- center_x=GrpcValue(circ_params[0]),
948
- center_y=GrpcValue(circ_params[1]),
949
- radius=GrpcValue(circ_params[2]),
943
+ center_x=Value(circ_params[0]),
944
+ center_y=Value(circ_params[1]),
945
+ radius=Value(circ_params[2]),
950
946
  )
951
947
  if not cloned_circle.is_null:
952
948
  cloned_circle.is_negative = True
@@ -1000,8 +996,8 @@ class Modeler(object):
1000
996
 
1001
997
  if not self._validatePoint(endPoint):
1002
998
  return None
1003
- startPoint = [GrpcValue(i) for i in startPoint]
1004
- endPoint = [GrpcValue(i) for i in endPoint]
999
+ startPoint = [Value(i) for i in startPoint]
1000
+ endPoint = [Value(i) for i in endPoint]
1005
1001
  if len(endPoint) == 2:
1006
1002
  is_parametric = (
1007
1003
  is_parametric
@@ -1059,7 +1055,7 @@ class Modeler(object):
1059
1055
  else:
1060
1056
  k = 0
1061
1057
  for pt in points:
1062
- point = [GrpcValue(i) for i in pt]
1058
+ point = [Value(i) for i in pt]
1063
1059
  new_points = GrpcPointData(point)
1064
1060
  if len(point) > 2:
1065
1061
  k += 1
@@ -1119,7 +1115,7 @@ class Modeler(object):
1119
1115
  # return None
1120
1116
  # pointA = GrpcPointData(pointA[0]), self._get_edb_value(shape.pointA[1])
1121
1117
  # )
1122
- # pointB = self._edb.geometry.point_data(
1118
+ # pointB = self._edb.Geometry.PointData(
1123
1119
  # self._get_edb_value(shape.pointB[0]), self._get_edb_value(shape.pointB[1])
1124
1120
  # )
1125
1121
  # return self._edb.geometry.polygon_data.create_from_bbox((pointA, pointB))
@@ -1163,14 +1159,14 @@ class Modeler(object):
1163
1159
  if not variable_value:
1164
1160
  variable_value = p.width
1165
1161
  self._pedb.active_cell.add_variable(
1166
- name=_parameter_name, value=GrpcValue(variable_value), is_param=True
1162
+ name=_parameter_name, value=Value(variable_value), is_param=True
1167
1163
  )
1168
- p.width = GrpcValue(_parameter_name, self._pedb.active_cell)
1164
+ p.width = Value(_parameter_name, self._pedb.active_cell)
1169
1165
  elif p.layer.name in layers_name:
1170
1166
  if not variable_value:
1171
1167
  variable_value = p.width
1172
1168
  self._pedb.add_design_variable(parameter_name, variable_value, True)
1173
- p.width = GrpcValue(_parameter_name, self._pedb.active_cell)
1169
+ p.width = Value(_parameter_name, self._pedb.active_cell)
1174
1170
  return True
1175
1171
 
1176
1172
  def unite_polygons_on_layer(
@@ -1199,6 +1195,8 @@ class Modeler(object):
1199
1195
  layer_name = [layer_name]
1200
1196
  if not layer_name:
1201
1197
  layer_name = list(self._pedb.stackup.signal_layers.keys())
1198
+ if net_names_list is None:
1199
+ net_names_list = []
1202
1200
 
1203
1201
  for lay in layer_name:
1204
1202
  self._logger.info(f"Uniting Objects on layer {lay}.")
@@ -1319,7 +1317,7 @@ class Modeler(object):
1319
1317
  primitives = self.primitives_by_layer[layer]
1320
1318
  for prim in primitives:
1321
1319
  if prim.primitive_type.name == "PATH":
1322
- surface += Path(self._pedb, prim).length * prim.cast().width.value
1320
+ surface += Path(self._pedb, prim).length * Value(prim.cast().width)
1323
1321
  if prim.primitive_type.name == "POLYGON":
1324
1322
  surface += prim.polygon_data.area()
1325
1323
  stat_model.occupying_surface[layer] = round(surface, 6)
@@ -1418,14 +1416,14 @@ class Modeler(object):
1418
1416
  bondwire_type=bondwire_type,
1419
1417
  definition_name=definition_name,
1420
1418
  placement_layer=placement_layer,
1421
- width=GrpcValue(width),
1419
+ width=Value(width),
1422
1420
  material=material,
1423
1421
  start_layer_name=start_layer_name,
1424
- start_x=GrpcValue(start_x),
1425
- start_y=GrpcValue(start_y),
1422
+ start_x=Value(start_x),
1423
+ start_y=Value(start_y),
1426
1424
  end_layer_name=end_layer_name,
1427
- end_x=GrpcValue(end_x),
1428
- end_y=GrpcValue(end_y),
1425
+ end_x=Value(end_x),
1426
+ end_y=Value(end_y),
1429
1427
  net=net,
1430
1428
  end_context=end_cell_inst,
1431
1429
  start_context=start_cell_inst,
@@ -1478,7 +1476,11 @@ class Modeler(object):
1478
1476
  if isinstance(pins_by_name, str):
1479
1477
  pins_by_name = [pins_by_name]
1480
1478
  p_inst = self._pedb.layout.padstack_instances
1481
- _pins = {pin.id: pin for pin in p_inst if pin.aedt_name in pins_by_aedt_name or pin.name in pins_by_name}
1479
+ _pins = {
1480
+ pin_id: pin
1481
+ for pin_id, pin in p_inst.items()
1482
+ if pin.aedt_name in pins_by_aedt_name or pin.name in pins_by_name
1483
+ }
1482
1484
  if not pins:
1483
1485
  pins = _pins
1484
1486
  else:
@@ -60,7 +60,7 @@ class Net(GrpcNet):
60
60
  self._pedb = pedb
61
61
  self._core_components = pedb.components
62
62
  self._core_primitive = pedb.modeler
63
- self._edb_object = raw_net
63
+ self.__primitives = []
64
64
 
65
65
  @property
66
66
  def primitives(self) -> list[Union[Path, Polygon, Circle, Rectangle, Bondwire]]:
@@ -76,19 +76,20 @@ class Net(GrpcNet):
76
76
  - :class:`Rectangle <pyedb.grpc.database.primitive.rectangle.Rectangle>`
77
77
  - :class:`Bondwire <pyedb.grpc.database.primitive.bondwire.Bondwire>`
78
78
  """
79
- primitives = []
80
- for primitive in super().primitives:
81
- if primitive.primitive_type == GrpcPrimitiveType.PATH:
82
- primitives.append(Path(self._pedb, primitive))
83
- elif primitive.primitive_type == GrpcPrimitiveType.POLYGON:
84
- primitives.append(Polygon(self._pedb, primitive))
85
- elif primitive.primitive_type == GrpcPrimitiveType.CIRCLE:
86
- primitives.append(Circle(self._pedb, primitive))
87
- elif primitive.primitive_type == GrpcPrimitiveType.RECTANGLE:
88
- primitives.append(Rectangle(self._pedb, primitive))
89
- elif primitive.primitive_type == GrpcPrimitiveType.BONDWIRE:
90
- primitives.append(Bondwire(self._pedb, primitive))
91
- return primitives
79
+ primitives = super().primitives
80
+ if not len(self.__primitives) == len(primitives):
81
+ for primitive in primitives:
82
+ if primitive.primitive_type == GrpcPrimitiveType.PATH:
83
+ self.__primitives.append(Path(self._pedb, primitive))
84
+ elif primitive.primitive_type == GrpcPrimitiveType.POLYGON:
85
+ self.__primitives.append(Polygon(self._pedb, primitive))
86
+ elif primitive.primitive_type == GrpcPrimitiveType.CIRCLE:
87
+ self.__primitives.append(Circle(self._pedb, primitive))
88
+ elif primitive.primitive_type == GrpcPrimitiveType.RECTANGLE:
89
+ self.__primitives.append(Rectangle(self._pedb, primitive))
90
+ elif primitive.primitive_type == GrpcPrimitiveType.BONDWIRE:
91
+ self.__primitives.append(Bondwire(self._pedb, primitive))
92
+ return self.__primitives
92
93
 
93
94
  @property
94
95
  def padstack_instances(self) -> list[PadstackInstance]:
@@ -22,11 +22,15 @@
22
22
 
23
23
  from __future__ import absolute_import # noreorder
24
24
 
25
+ from typing import Any, Dict, List, Optional, Set, Tuple, Union
25
26
  import warnings
26
27
 
28
+ from ansys.edb.core.net.net_class import NetClass as GrpcNetClass
29
+
27
30
  from pyedb.common.nets import CommonNets
28
31
  from pyedb.generic.general_methods import generate_unique_name
29
32
  from pyedb.grpc.database.net.net import Net
33
+ from pyedb.grpc.database.net.net_class import NetClass
30
34
  from pyedb.grpc.database.primitive.bondwire import Bondwire
31
35
  from pyedb.grpc.database.primitive.path import Path
32
36
  from pyedb.grpc.database.primitive.polygon import Polygon
@@ -152,7 +156,7 @@ class Nets(CommonNets):
152
156
  >>> edbapp.close()
153
157
  """
154
158
 
155
- def __getitem__(self, name):
159
+ def __getitem__(self, name: str) -> Net:
156
160
  """Get a net by name.
157
161
 
158
162
  Parameters
@@ -172,7 +176,7 @@ class Nets(CommonNets):
172
176
  """
173
177
  return Net(self._pedb, Net.find_by_name(self._active_layout, name))
174
178
 
175
- def __contains__(self, name):
179
+ def __contains__(self, name: str) -> bool:
176
180
  """Check if a net exists in the layout.
177
181
 
178
182
  Parameters
@@ -192,11 +196,11 @@ class Nets(CommonNets):
192
196
  """
193
197
  return name in self.nets
194
198
 
195
- def __init__(self, p_edb):
199
+ def __init__(self, p_edb: Any) -> None:
196
200
  """Initialize the Nets class."""
197
201
  CommonNets.__init__(self, p_edb)
198
- self._nets_by_comp_dict = {}
199
- self._comps_by_nets_dict = {}
202
+ self._nets_by_comp_dict: Dict[str, List[str]] = {}
203
+ self._comps_by_nets_dict: Dict[str, List[str]] = {}
200
204
 
201
205
  @property
202
206
  def _edb(self):
@@ -229,7 +233,7 @@ class Nets(CommonNets):
229
233
  return self._pedb.logger
230
234
 
231
235
  @property
232
- def nets(self):
236
+ def nets(self) -> Dict[str, Net]:
233
237
  """All nets in the layout.
234
238
 
235
239
  Returns
@@ -246,7 +250,7 @@ class Nets(CommonNets):
246
250
  return {i.name: i for i in self._pedb.layout.nets}
247
251
 
248
252
  @property
249
- def netlist(self):
253
+ def netlist(self) -> List[str]:
250
254
  """List of all net names.
251
255
 
252
256
  Returns
@@ -262,7 +266,7 @@ class Nets(CommonNets):
262
266
  return list(self.nets.keys())
263
267
 
264
268
  @property
265
- def signal(self):
269
+ def signal(self) -> Dict[str, Net]:
266
270
  """Signal nets in the layout.
267
271
 
268
272
  Returns
@@ -282,7 +286,7 @@ class Nets(CommonNets):
282
286
  return nets
283
287
 
284
288
  @property
285
- def power(self):
289
+ def power(self) -> Dict[str, Net]:
286
290
  """Power and ground nets in the layout.
287
291
 
288
292
  Returns
@@ -301,7 +305,7 @@ class Nets(CommonNets):
301
305
  nets[net] = value
302
306
  return nets
303
307
 
304
- def eligible_power_nets(self, threshold=0.3):
308
+ def eligible_power_nets(self, threshold: float = 0.3) -> List[Net]:
305
309
  """Identify nets eligible for power/ground classification based on area ratio.
306
310
 
307
311
  Uses the same algorithm implemented in SIwave.
@@ -343,7 +347,7 @@ class Nets(CommonNets):
343
347
  return pwr_gnd_nets
344
348
 
345
349
  @property
346
- def nets_by_components(self):
350
+ def nets_by_components(self) -> Dict[str, List[str]]:
347
351
  """Mapping of components to their associated nets.
348
352
 
349
353
  Returns
@@ -361,7 +365,7 @@ class Nets(CommonNets):
361
365
  return self._nets_by_comp_dict
362
366
 
363
367
  @property
364
- def components_by_nets(self):
368
+ def components_by_nets(self) -> Dict[str, List[str]]:
365
369
  """Mapping of nets to their associated components.
366
370
 
367
371
  Returns
@@ -384,13 +388,13 @@ class Nets(CommonNets):
384
388
 
385
389
  def generate_extended_nets(
386
390
  self,
387
- resistor_below=10,
388
- inductor_below=1,
389
- capacitor_above=1,
390
- exception_list=None,
391
- include_signal=True,
392
- include_power=True,
393
- ):
391
+ resistor_below: Union[int, float] = 10,
392
+ inductor_below: Union[int, float] = 1,
393
+ capacitor_above: Union[int, float] = 1,
394
+ exception_list: Optional[List[str]] = None,
395
+ include_signal: bool = True,
396
+ include_power: bool = True,
397
+ ) -> List[Any]:
394
398
  """Generate extended nets based on component thresholds.
395
399
 
396
400
  .. deprecated:: pyedb 0.30.0
@@ -430,7 +434,7 @@ class Nets(CommonNets):
430
434
  )
431
435
 
432
436
  @staticmethod
433
- def _get_points_for_plot(my_net_points):
437
+ def _get_points_for_plot(my_net_points: List[Any]) -> Tuple[List[float], List[float]]:
434
438
  """Get points for plotting.
435
439
 
436
440
  Parameters
@@ -464,7 +468,9 @@ class Nets(CommonNets):
464
468
  # fmt: on
465
469
  return x, y
466
470
 
467
- def classify_nets(self, power_nets=None, signal_nets=None):
471
+ def classify_nets(
472
+ self, power_nets: Optional[Union[str, List[str]]] = None, signal_nets: Optional[Union[str, List[str]]] = None
473
+ ) -> bool:
468
474
  """Reassign net classifications as power/ground or signal.
469
475
 
470
476
  Parameters
@@ -502,7 +508,7 @@ class Nets(CommonNets):
502
508
  self.nets[net].is_power_ground = False
503
509
  return True
504
510
 
505
- def is_power_gound_net(self, netname_list):
511
+ def is_power_gound_net(self, netname_list: Union[str, List[str]]) -> bool:
506
512
  """Check if any net in a list is a power/ground net.
507
513
 
508
514
  Parameters
@@ -528,7 +534,7 @@ class Nets(CommonNets):
528
534
  return True
529
535
  return False
530
536
 
531
- def get_dcconnected_net_list(self, ground_nets=["GND"], res_value=0.001):
537
+ def get_dcconnected_net_list(self, ground_nets: List[str] = ["GND"], res_value: float = 0.001) -> List[Set[str]]:
532
538
  """Get nets connected to DC through inductors and low-value resistors.
533
539
 
534
540
  Parameters
@@ -586,7 +592,9 @@ class Nets(CommonNets):
586
592
 
587
593
  return dcconnected_net_list
588
594
 
589
- def get_powertree(self, power_net_name, ground_nets):
595
+ def get_powertree(
596
+ self, power_net_name: str, ground_nets: List[str]
597
+ ) -> Tuple[List[List[str]], List[str], List[str]]:
590
598
  """Retrieve power tree for a given power net.
591
599
 
592
600
  Parameters
@@ -654,7 +662,7 @@ class Nets(CommonNets):
654
662
  ]
655
663
  return component_list, component_list_columns, net_group
656
664
 
657
- def get_net_by_name(self, net_name):
665
+ def get_net_by_name(self, net_name: str) -> Optional[Net]:
658
666
  """Find a net by name.
659
667
 
660
668
  Parameters
@@ -677,7 +685,7 @@ class Nets(CommonNets):
677
685
  if edb_net is not None:
678
686
  return edb_net
679
687
 
680
- def delete(self, netlist):
688
+ def delete(self, netlist: Union[str, List[str]]) -> List[str]:
681
689
  """Delete one or more nets from the layout.
682
690
 
683
691
  Parameters
@@ -708,7 +716,9 @@ class Nets(CommonNets):
708
716
  nets_deleted.append(i.name)
709
717
  return nets_deleted
710
718
 
711
- def find_or_create_net(self, net_name="", start_with="", contain="", end_with=""):
719
+ def find_or_create_net(
720
+ self, net_name: str = "", start_with: str = "", contain: str = "", end_with: str = ""
721
+ ) -> Union[Net, List[Net]]:
712
722
  """Find or create a net based on given criteria.
713
723
 
714
724
  Parameters
@@ -789,7 +799,7 @@ class Nets(CommonNets):
789
799
  nets_found = [self.nets[net] for net in list(self.nets.keys()) if contain in net.lower()]
790
800
  return nets_found
791
801
 
792
- def is_net_in_component(self, component_name, net_name):
802
+ def is_net_in_component(self, component_name: str, net_name: str) -> bool:
793
803
  """Check if a net belongs to a component.
794
804
 
795
805
  Parameters
@@ -817,8 +827,12 @@ class Nets(CommonNets):
817
827
  return False
818
828
 
819
829
  def find_and_fix_disjoint_nets(
820
- self, net_list=None, keep_only_main_net=False, clean_disjoints_less_than=0.0, order_by_area=False
821
- ):
830
+ self,
831
+ net_list: Optional[List[str]] = None,
832
+ keep_only_main_net: bool = False,
833
+ clean_disjoints_less_than: float = 0.0,
834
+ order_by_area: bool = False,
835
+ ) -> List[str]:
822
836
  """Find and fix disjoint nets.
823
837
 
824
838
  .. deprecated:: pyedb 0.30.0
@@ -856,7 +870,7 @@ class Nets(CommonNets):
856
870
  net_list, keep_only_main_net, clean_disjoints_less_than, order_by_area
857
871
  )
858
872
 
859
- def merge_nets_polygons(self, net_names_list):
873
+ def merge_nets_polygons(self, net_names_list: Union[str, List[str]]) -> bool:
860
874
  """Merge polygons for specified nets on each layer.
861
875
 
862
876
  Parameters
@@ -877,3 +891,70 @@ class Nets(CommonNets):
877
891
  if isinstance(net_names_list, str):
878
892
  net_names_list = [net_names_list]
879
893
  return self._pedb.modeler.unite_polygons_on_layer(net_names_list=net_names_list)
894
+
895
+
896
+ class NetClasses:
897
+ """Net classes management.
898
+
899
+ This class provides access to net classes in the EDB layout.
900
+ It allows for operations like retrieving nets, adding/removing nets,
901
+ and checking if a net is part of a net class.
902
+
903
+ Examples
904
+ --------
905
+ >>> from pyedb import Edb
906
+ >>> edb = Edb(myedb, edbversion="2025.1")
907
+ >>> net_classes = edb.net_classes
908
+ """
909
+
910
+ def __init__(self, pedb):
911
+ self._pedb = pedb
912
+ self._net_classes = pedb.active_layout.net_classes
913
+
914
+ def __getitem__(self, name: str) -> NetClass:
915
+ """Get a net by name.
916
+
917
+ Parameters
918
+ ----------
919
+ name : str
920
+ Name of the net to retrieve.
921
+
922
+ """
923
+ return self.items[name]
924
+
925
+ @property
926
+ def items(self) -> Dict[str, NetClass]:
927
+ """Extended nets.
928
+
929
+ Returns
930
+ -------
931
+ Dict[str, :class:`pyedb.grpc.database.nets.nets_class.NetClass`]
932
+ Dictionary of extended nets.
933
+ """
934
+ return {i.name: i for i in self._pedb.layout.net_classes}
935
+
936
+ def create(self, name, net) -> Union[bool, NetClass]:
937
+ """Create a new net class.
938
+
939
+ Parameters
940
+ ----------
941
+ name : str
942
+ Name of the net class.
943
+ net : str, list
944
+ Name of the nets to be added into this net class.
945
+
946
+ Returns
947
+ -------
948
+ :class:`pyedb.dotnet.database.edb_data.nets_data.EDBNetClassData` `False` if net name already exists.
949
+ """
950
+ if name in self.items:
951
+ self._pedb.logger.error("{} already exists.".format(name))
952
+ return False
953
+ grpc_net_class = GrpcNetClass.create(self._pedb.active_layout, name)
954
+ if isinstance(net, str):
955
+ net = [net]
956
+ for i in net:
957
+ grpc_net_class.add_net(self._pedb.nets[i])
958
+ net_class = NetClass(self._pedb, grpc_net_class)
959
+ self.items[name] = net_class
960
+ return net_class