pyedb 0.43.0__py3-none-any.whl → 0.45.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 (68) hide show
  1. pyedb/__init__.py +1 -1
  2. pyedb/configuration/cfg_boundaries.py +21 -15
  3. pyedb/configuration/cfg_components.py +8 -8
  4. pyedb/configuration/cfg_general.py +14 -6
  5. pyedb/configuration/cfg_modeler.py +8 -0
  6. pyedb/configuration/cfg_operations.py +40 -1
  7. pyedb/configuration/cfg_package_definition.py +41 -1
  8. pyedb/configuration/cfg_padstacks.py +611 -256
  9. pyedb/configuration/cfg_pin_groups.py +1 -1
  10. pyedb/configuration/cfg_ports_sources.py +234 -66
  11. pyedb/configuration/cfg_s_parameter_models.py +81 -1
  12. pyedb/configuration/cfg_setup.py +167 -33
  13. pyedb/configuration/cfg_stackup.py +44 -0
  14. pyedb/configuration/configuration.py +13 -3
  15. pyedb/dotnet/database/cell/primitive/path.py +12 -0
  16. pyedb/dotnet/database/edb_data/design_options.py +19 -1
  17. pyedb/dotnet/database/edb_data/padstacks_data.py +9 -4
  18. pyedb/dotnet/database/geometry/point_data.py +26 -0
  19. pyedb/dotnet/database/geometry/polygon_data.py +13 -2
  20. pyedb/dotnet/database/nets.py +13 -3
  21. pyedb/dotnet/database/padstack.py +6 -2
  22. pyedb/dotnet/database/utilities/simulation_setup.py +7 -17
  23. pyedb/dotnet/database/utilities/siwave_simulation_setup.py +30 -0
  24. pyedb/dotnet/edb.py +41 -18
  25. pyedb/grpc/database/components.py +2 -3
  26. pyedb/grpc/database/definition/component_def.py +15 -0
  27. pyedb/grpc/database/definition/component_pin.py +1 -1
  28. pyedb/grpc/database/definition/materials.py +27 -0
  29. pyedb/grpc/database/definition/package_def.py +20 -2
  30. pyedb/grpc/database/definition/padstack_def.py +5 -2
  31. pyedb/grpc/database/hfss.py +10 -1
  32. pyedb/grpc/database/hierarchy/component.py +4 -2
  33. pyedb/grpc/database/hierarchy/pingroup.py +12 -8
  34. pyedb/grpc/database/layers/layer.py +28 -0
  35. pyedb/grpc/database/layers/stackup_layer.py +281 -40
  36. pyedb/grpc/database/layout/layout.py +12 -6
  37. pyedb/grpc/database/layout_validation.py +2 -2
  38. pyedb/grpc/database/modeler.py +8 -8
  39. pyedb/grpc/database/padstacks.py +15 -9
  40. pyedb/grpc/database/ports/ports.py +3 -3
  41. pyedb/grpc/database/primitive/bondwire.py +3 -3
  42. pyedb/grpc/database/primitive/circle.py +1 -1
  43. pyedb/grpc/database/primitive/padstack_instance.py +13 -3
  44. pyedb/grpc/database/primitive/path.py +2 -2
  45. pyedb/grpc/database/primitive/polygon.py +3 -3
  46. pyedb/grpc/database/primitive/primitive.py +1 -1
  47. pyedb/grpc/database/primitive/rectangle.py +2 -2
  48. pyedb/grpc/database/simulation_setup/hfss_simulation_setup.py +78 -30
  49. pyedb/grpc/database/simulation_setup/siwave_simulation_setup.py +73 -30
  50. pyedb/grpc/database/simulation_setup/sweep_data.py +12 -1
  51. pyedb/grpc/database/siwave.py +10 -1
  52. pyedb/grpc/database/source_excitations.py +19 -9
  53. pyedb/grpc/database/stackup.py +26 -10
  54. pyedb/grpc/database/terminal/bundle_terminal.py +3 -3
  55. pyedb/grpc/database/terminal/edge_terminal.py +95 -2
  56. pyedb/grpc/database/terminal/padstack_instance_terminal.py +42 -2
  57. pyedb/grpc/database/terminal/pingroup_terminal.py +48 -2
  58. pyedb/grpc/database/terminal/point_terminal.py +10 -1
  59. pyedb/grpc/database/terminal/terminal.py +4 -4
  60. pyedb/grpc/database/utility/hfss_extent_info.py +14 -10
  61. pyedb/grpc/edb.py +21 -17
  62. pyedb/grpc/edb_init.py +19 -15
  63. pyedb/grpc/rpc_session.py +11 -8
  64. pyedb/misc/misc.py +13 -0
  65. {pyedb-0.43.0.dist-info → pyedb-0.45.0.dist-info}/METADATA +6 -6
  66. {pyedb-0.43.0.dist-info → pyedb-0.45.0.dist-info}/RECORD +68 -68
  67. {pyedb-0.43.0.dist-info → pyedb-0.45.0.dist-info}/LICENSE +0 -0
  68. {pyedb-0.43.0.dist-info → pyedb-0.45.0.dist-info}/WHEEL +0 -0
pyedb/dotnet/edb.py CHANGED
@@ -41,13 +41,13 @@ from zipfile import ZipFile as zpf
41
41
  import rtree
42
42
 
43
43
  from pyedb.configuration.configuration import Configuration
44
+ import pyedb.dotnet
44
45
  from pyedb.dotnet.database.Variables import decompose_variable_value
45
46
  from pyedb.dotnet.database.cell.layout import Layout
46
47
  from pyedb.dotnet.database.cell.terminal.terminal import Terminal
47
48
  from pyedb.dotnet.database.components import Components
48
49
  import pyedb.dotnet.database.dotnet.database
49
50
  from pyedb.dotnet.database.dotnet.database import Database
50
- from pyedb.dotnet.database.edb_data.control_file import convert_technology_file
51
51
  from pyedb.dotnet.database.edb_data.design_options import EdbDesignOptions
52
52
  from pyedb.dotnet.database.edb_data.edbvalue import EdbValue
53
53
  from pyedb.dotnet.database.edb_data.ports import (
@@ -134,9 +134,17 @@ class Edb(Database):
134
134
  Reference to the AEDT project object.
135
135
  student_version : bool, optional
136
136
  Whether to open the AEDT student version. The default is ``False.``
137
+ control_file : str, optional
138
+ Path to the XML file. The default is ``None``, in which case an attempt is made to find
139
+ the XML file in the same directory as the board file. To succeed, the XML file and board file
140
+ must have the same name. Only the extension differs.
141
+ map_file : str, optional
142
+ Layer map .map file.
137
143
  technology_file : str, optional
138
144
  Full path to technology file to be converted to xml before importing or xml.
139
145
  Supported by GDS format only.
146
+ layer_filter:str,optional
147
+ Layer filter .txt file.
140
148
 
141
149
  Examples
142
150
  --------
@@ -182,7 +190,10 @@ class Edb(Database):
182
190
  oproject=None,
183
191
  student_version: bool = False,
184
192
  use_ppe: bool = False,
193
+ control_file: str = None,
194
+ map_file: str = None,
185
195
  technology_file: str = None,
196
+ layer_filter: str = None,
186
197
  remove_existing_aedt: bool = False,
187
198
  ):
188
199
  if isinstance(edbpath, Path):
@@ -232,27 +243,35 @@ class Edb(Database):
232
243
  zipped_file.extractall(edbpath[:-4])
233
244
  self.logger.info("ODB++ unzipped successfully.")
234
245
  zipped_file.close()
235
- control_file = None
236
- if technology_file:
237
- if os.path.splitext(technology_file)[1] == ".xml":
238
- control_file = technology_file
239
- else:
240
- control_file = convert_technology_file(technology_file, edbversion=edbversion)
241
246
  self.logger.info("Translating ODB++ to EDB...")
242
- self.import_layout_file(edbpath[:-4], working_dir, use_ppe=use_ppe, control_file=control_file)
247
+ if not self.import_layout_file(
248
+ edbpath[:-4],
249
+ working_dir,
250
+ use_ppe=use_ppe,
251
+ control_file=control_file,
252
+ tech_file=technology_file,
253
+ layer_filter=layer_filter,
254
+ map_file=map_file,
255
+ ):
256
+ raise AttributeError("Translation was unsuccessful")
257
+ return False
243
258
  if settings.enable_local_log_file and self.log_name:
244
259
  self._logger.add_file_logger(self.log_name, "Edb")
245
260
  self.logger.info("EDB %s was created correctly from %s file.", self.edbpath, edbpath)
246
261
  elif edbpath[-3:] in ["brd", "mcm", "sip", "gds", "xml", "dxf", "tgz", "anf"]:
247
262
  self.edbpath = edbpath[:-4] + ".aedb"
248
263
  working_dir = os.path.dirname(edbpath)
249
- control_file = None
250
- if technology_file:
251
- if os.path.splitext(technology_file)[1] == ".xml":
252
- control_file = technology_file
253
- else:
254
- control_file = convert_technology_file(technology_file, edbversion=edbversion)
255
- self.import_layout_file(edbpath, working_dir, use_ppe=use_ppe, control_file=control_file)
264
+ if not self.import_layout_file(
265
+ edbpath,
266
+ working_dir,
267
+ use_ppe=use_ppe,
268
+ control_file=control_file,
269
+ tech_file=technology_file,
270
+ layer_filter=layer_filter,
271
+ map_file=map_file,
272
+ ):
273
+ raise AttributeError("Translation was unsuccessful")
274
+ return False
256
275
  if settings.enable_local_log_file and self.log_name:
257
276
  self._logger.add_file_logger(self.log_name, "Edb")
258
277
  self.logger.info("EDB %s was created correctly from %s file.", self.edbpath, edbpath[-2:])
@@ -371,6 +390,11 @@ class Edb(Database):
371
390
  self._stackup2 = self._stackup
372
391
  self._materials = Materials(self)
373
392
 
393
+ @property
394
+ def pedb_class(self):
395
+ if not self.grpc:
396
+ return pyedb.dotnet
397
+
374
398
  @property
375
399
  def grpc(self):
376
400
  """grpc flag."""
@@ -584,7 +608,7 @@ class Edb(Database):
584
608
  # self.standalone = False
585
609
 
586
610
  self.run_as_standalone(self.standalone)
587
- self.create(self.edbpath)
611
+ self._db = self.create(self.edbpath)
588
612
  if not self.active_db:
589
613
  self.logger.warning("Error creating the database.")
590
614
  self._active_cell = None
@@ -733,8 +757,7 @@ class Edb(Database):
733
757
  cmd_translator.append('-t="{}"'.format(tech_file))
734
758
  if layer_filter:
735
759
  cmd_translator.append('-f="{}"'.format(layer_filter))
736
- p = subprocess.Popen(cmd_translator)
737
- p.wait()
760
+ subprocess.run(cmd_translator)
738
761
  if not os.path.exists(os.path.join(working_dir, aedb_name)):
739
762
  self.logger.error("Translator failed to translate.")
740
763
  return False
@@ -178,8 +178,7 @@ class Components(object):
178
178
  @property
179
179
  def nport_comp_definition(self):
180
180
  """Retrieve Nport component definition list."""
181
- m = "Ansys.Ansoft.Edb.Definition.NPortComponentModel"
182
- return {name: l for name, l in self.definitions.items() if m in [i for i in l.model]}
181
+ return {name: l for name, l in self.definitions.items() if l.reference_file}
183
182
 
184
183
  def import_definition(self, file_path):
185
184
  """Import component definition from json file.
@@ -2280,7 +2279,7 @@ class Components(object):
2280
2279
  if not pin.net.is_null:
2281
2280
  if pin.net.name:
2282
2281
  pingroup.net = pin.net
2283
- return group_name
2282
+ return group_name, PinGroup(self._pedb, pingroup)
2284
2283
  return False
2285
2284
 
2286
2285
  def create_pin_group_on_net(self, reference_designator, net_name, group_name=None):
@@ -216,3 +216,18 @@ class ComponentDef(GrpcComponentDef):
216
216
  n_port_model.reference_file = fpath
217
217
  self.add_component_model(n_port_model)
218
218
  return n_port_model
219
+
220
+ def get_properties(self):
221
+ data = {}
222
+ temp = []
223
+ for i in self.component_pins:
224
+ temp.append(i.name)
225
+ data["pin_order"] = temp
226
+ return data
227
+
228
+ def set_properties(self, **kwargs):
229
+ pin_order = kwargs.get("pin_order")
230
+ if pin_order:
231
+ old = {i.name: i for i in self.component_pins}
232
+ temp = [old[str(i)] for i in pin_order]
233
+ self.reorder_pins(temp)
@@ -28,5 +28,5 @@ class ComponentPin(GrpcComponentPin):
28
28
  """Class managing :class:`ComponentPin <ansys.edb.core.definition.component_pin.ComponentPin>`."""
29
29
 
30
30
  def __init__(self, pedb, edb_object):
31
- super().__init__(edb_object)
31
+ super().__init__(edb_object.msg)
32
32
  self._pedb = pedb
@@ -587,6 +587,33 @@ class Material(GrpcMaterialDef):
587
587
  class Materials(object):
588
588
  """Manages EDB methods for material management accessible from `Edb.materials` property."""
589
589
 
590
+ default_conductor_property_values = {
591
+ "conductivity": 58000000,
592
+ "dielectric_loss_tangent": 0,
593
+ "magnetic_loss_tangent": 0,
594
+ "mass_density": 8933,
595
+ "permittivity": 1,
596
+ "permeability": 0.999991,
597
+ "poisson_ratio": 0.38,
598
+ "specific_heat": 385,
599
+ "thermal_conductivity": 400,
600
+ "youngs_modulus": 120000000000,
601
+ "thermal_expansion_coefficient": 1.77e-05,
602
+ }
603
+ default_dielectric_property_values = {
604
+ "conductivity": 0,
605
+ "dielectric_loss_tangent": 0.02,
606
+ "magnetic_loss_tangent": 0,
607
+ "mass_density": 1900,
608
+ "permittivity": 4.4,
609
+ "permeability": 1,
610
+ "poisson_ratio": 0.28,
611
+ "specific_heat": 1150,
612
+ "thermal_conductivity": 0.294,
613
+ "youngs_modulus": 11000000000,
614
+ "thermal_expansion_coefficient": 1.5e-05,
615
+ }
616
+
590
617
  def __init__(self, edb: Edb):
591
618
  self.__edb = edb
592
619
  self.__syslib = os.path.join(self.__edb.base_path, "syslib")
@@ -26,6 +26,7 @@ from ansys.edb.core.utility.value import Value as GrpcValue
26
26
 
27
27
  from pyedb.edb_logger import pyedb_logger
28
28
  from pyedb.grpc.database.utility.heat_sink import HeatSink
29
+ from pyedb.misc.misc import deprecated_property
29
30
 
30
31
 
31
32
  class PackageDef(GrpcPackageDef):
@@ -45,6 +46,11 @@ class PackageDef(GrpcPackageDef):
45
46
  """
46
47
 
47
48
  def __init__(self, pedb, edb_object=None, name=None, component_part_name=None, extent_bounding_box=None):
49
+ if not edb_object:
50
+ if name:
51
+ edb_object = GrpcPackageDef.create(db=pedb.active_db, name=name)
52
+ else:
53
+ raise AttributeError("Name must be provided to create and instantiate a PackageDef object.")
48
54
  super(GrpcPackageDef, self).__init__(edb_object.msg)
49
55
  self._pedb = pedb
50
56
  self._edb_object = edb_object
@@ -129,7 +135,6 @@ class PackageDef(GrpcPackageDef):
129
135
 
130
136
  @therm_cond.setter
131
137
  def therm_cond(self, value):
132
- self.therm_cond = GrpcValue(value)
133
138
  super(PackageDef, self.__class__).thermal_conductivity.__set__(self, GrpcValue(value))
134
139
 
135
140
  @property
@@ -186,7 +191,20 @@ class PackageDef(GrpcPackageDef):
186
191
  :class:`HeatSink <pyedb.grpc.database.utility.heat_sink.HeatSink>`
187
192
  HeatSink object.
188
193
  """
189
- return HeatSink(self._pedb, super().heat_sink)
194
+ try:
195
+ return HeatSink(self._pedb, super().heat_sink)
196
+ except:
197
+ pass
198
+
199
+ @property
200
+ @deprecated_property
201
+ def heatsink(self):
202
+ """Property added for .NET compatibility.
203
+ . deprecated:: pyedb 0.43.0
204
+ Use :func:`heat_sink` instead.
205
+
206
+ """
207
+ return self.heat_sink
190
208
 
191
209
  def set_heatsink(self, fin_base_height, fin_height, fin_orientation, fin_spacing, fin_thickness):
192
210
  """Set Heat sink.
@@ -34,7 +34,7 @@ import ansys.edb.core.geometry.polygon_data
34
34
  from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData
35
35
  from ansys.edb.core.hierarchy.structure3d import MeshClosure as GrpcMeshClosure
36
36
  from ansys.edb.core.hierarchy.structure3d import Structure3D as GrpcStructure3D
37
- from ansys.edb.core.primitive.primitive import Circle as GrpcCircle
37
+ from ansys.edb.core.primitive.circle import Circle as GrpcCircle
38
38
  from ansys.edb.core.utility.value import Value as GrpcValue
39
39
 
40
40
  from pyedb.generic.general_methods import generate_unique_name
@@ -577,7 +577,10 @@ class PadstackDef(GrpcPadstackDef):
577
577
  Possible returned values are ``"through"``, ``"begin_on_upper_pad"``,
578
578
  ``"end_on_lower_pad"``, ``"upper_pad_to_lower_pad"``, and ``"undefined"``.
579
579
  """
580
- return self.data.hole_range.name.lower()
580
+ try:
581
+ return self.data.hole_range.name.lower()
582
+ except:
583
+ return None
581
584
 
582
585
  @hole_range.setter
583
586
  def hole_range(self, value):
@@ -1240,6 +1240,12 @@ class Hfss(object):
1240
1240
  from ansys.edb.core.simulation_setup.hfss_simulation_setup import (
1241
1241
  HfssSimulationSetup as GrpcHfssSimulationSetup,
1242
1242
  )
1243
+ from ansys.edb.core.simulation_setup.simulation_setup import (
1244
+ Distribution as GrpcDistribution,
1245
+ )
1246
+ from ansys.edb.core.simulation_setup.simulation_setup import (
1247
+ FrequencyData as GrpcFrequencyData,
1248
+ )
1243
1249
  from ansys.edb.core.simulation_setup.simulation_setup import (
1244
1250
  SweepData as GrpcSweepData,
1245
1251
  )
@@ -1267,7 +1273,10 @@ class Hfss(object):
1267
1273
  sweep_name = f"sweep_{len(setup.sweep_data) + 1}"
1268
1274
  sweep_data = [
1269
1275
  GrpcSweepData(
1270
- name=sweep_name, distribution=distribution, start_f=start_freq, end_f=stop_freq, step=step_freq
1276
+ name=sweep_name,
1277
+ frequency_data=GrpcFrequencyData(
1278
+ distribution=GrpcDistribution[distribution], start_f=start_freq, end_f=stop_freq, step=step_freq
1279
+ ),
1271
1280
  )
1272
1281
  ]
1273
1282
  if discrete_sweep:
@@ -42,8 +42,10 @@ from ansys.edb.core.hierarchy.sparameter_model import (
42
42
  SParameterModel as GrpcSParameterModel,
43
43
  )
44
44
  from ansys.edb.core.hierarchy.spice_model import SPICEModel as GrpcSPICEModel
45
- from ansys.edb.core.primitive.primitive import PadstackInstance as GrpcPadstackInstance
46
- from ansys.edb.core.terminal.terminals import (
45
+ from ansys.edb.core.primitive.padstack_instance import (
46
+ PadstackInstance as GrpcPadstackInstance,
47
+ )
48
+ from ansys.edb.core.terminal.padstack_instance_terminal import (
47
49
  PadstackInstanceTerminal as GrpcPadstackInstanceTerminal,
48
50
  )
49
51
  from ansys.edb.core.utility.rlc import Rlc as GrpcRlc
@@ -22,7 +22,7 @@
22
22
 
23
23
 
24
24
  from ansys.edb.core.hierarchy.pin_group import PinGroup as GrpcPinGroup
25
- from ansys.edb.core.terminal.terminals import BoundaryType as GrpcBoundaryType
25
+ from ansys.edb.core.terminal.terminal import BoundaryType as GrpcBoundaryType
26
26
  from ansys.edb.core.utility.value import Value as GrpcValue
27
27
 
28
28
  from pyedb.generic.general_methods import generate_unique_name
@@ -74,9 +74,9 @@ class PinGroup(GrpcPinGroup):
74
74
 
75
75
  Returns
76
76
  -------
77
- List[:class:`PadstackInstance <pyedb.grpc.database.primitive.padstack_instance.PadstackInstance>`].
77
+ Dict[:class:`PadstackInstance <pyedb.grpc.database.primitive.padstack_instance.PadstackInstance>`].
78
78
  """
79
- return [PadstackInstance(self._pedb, i) for i in super().pins]
79
+ return {i.name: PadstackInstance(self._pedb, i) for i in super().pins}
80
80
 
81
81
  @property
82
82
  def net(self):
@@ -105,11 +105,15 @@ class PinGroup(GrpcPinGroup):
105
105
  """
106
106
  return self.net.name
107
107
 
108
- # @property
109
- # def terminal(self):
110
- # """Terminal."""
111
- # term = PinGroupTerminal(self._pedb, self.get_pin_group_terminal()) # TODO check method is missing
112
- # return term if not term.is_null else None
108
+ @property
109
+ def terminal(self):
110
+ """Terminal."""
111
+ term = self.pin_group_terminal
112
+ if not term.is_null:
113
+ term = PinGroupTerminal(self._pedb, term)
114
+ return term
115
+ else:
116
+ return None
113
117
 
114
118
  def create_terminal(self, name=None):
115
119
  """Create a terminal.
@@ -52,6 +52,34 @@ class Layer(GrpcLayer):
52
52
  else:
53
53
  self._pedb.logger.error(f"{k} is not a valid layer attribute")
54
54
 
55
+ @property
56
+ def properties(self):
57
+ from ansys.edb.core.layer.stackup_layer import StackupLayer as GrpcStackupLayer
58
+
59
+ from pyedb.grpc.database.stackup import StackupLayer
60
+
61
+ if isinstance(self.cast(), GrpcStackupLayer):
62
+ return StackupLayer(self._pedb, self.cast()).properties
63
+ else:
64
+ data = {"name": self.name, "type": self.type, "color": self.color}
65
+ return data
66
+
67
+ @properties.setter
68
+ def properties(self, params):
69
+ name = params.get("name", "")
70
+ if name:
71
+ self.name = name
72
+ type = params.get("type", "")
73
+ if type:
74
+ self.type = type
75
+ color = params.get("color", "")
76
+ if color:
77
+ self.color = color
78
+
79
+ @property
80
+ def type(self):
81
+ return super().type.name.lower().split("_")[0]
82
+
55
83
  @property
56
84
  def _layer_name_mapping_reversed(self):
57
85
  return {j: i for i, j in self._layer_name_mapping.items()}