Skip to content

Commit 22f49c8

Browse files
authored
Merge branch 'main' into test-doc-grpc
2 parents 5e28f8b + 79b127f commit 22f49c8

File tree

17 files changed

+380
-643
lines changed

17 files changed

+380
-643
lines changed

src/pyedb/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def custom_show_warning(message, category, filename, lineno, file=None, line=Non
4444
#
4545

4646
pyedb_path = os.path.dirname(__file__)
47-
__version__ = "0.50.dev0"
47+
__version__ = "0.51.dev0"
4848
version = __version__
4949

5050
#

src/pyedb/configuration/cfg_ports_sources.py

Lines changed: 79 additions & 239 deletions
Large diffs are not rendered by default.

src/pyedb/configuration/configuration.py

Lines changed: 213 additions & 340 deletions
Large diffs are not rendered by default.

src/pyedb/dotnet/clr_module.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def custom_show_warning(message, category, filename, lineno, file=None, line=Non
3838

3939
dotnet_root = None
4040
runtime_config = None
41+
runtime_spec = None
4142
# Use system .NET core runtime or fall back to dotnetcore2
4243
if os.environ.get("DOTNET_ROOT") is None:
4344
try:
@@ -78,11 +79,16 @@ def custom_show_warning(message, category, filename, lineno, file=None, line=Non
7879
"Please ensure that .NET SDK is correctly installed or "
7980
"that DOTNET_ROOT is correctly set."
8081
)
81-
runtime_config = candidates[0]
82+
runtime_spec = candidates[0]
8283
# Use specific .NET core runtime
83-
if dotnet_root is not None and runtime_config is not None:
84+
if dotnet_root is not None and (runtime_config is not None or runtime_spec is not None):
8485
try:
85-
load("coreclr", runtime_config=str(runtime_config), dotnet_root=str(dotnet_root))
86+
load(
87+
"coreclr",
88+
runtime_config=str(runtime_config) if runtime_config else None,
89+
runtime_spec=runtime_spec,
90+
dotnet_root=str(dotnet_root),
91+
)
8692
os.environ["DOTNET_ROOT"] = dotnet_root.as_posix()
8793
if "mono" not in os.getenv("LD_LIBRARY_PATH", ""):
8894
warnings.warn("LD_LIBRARY_PATH needs to be setup to use pyedb.")

src/pyedb/dotnet/database/cell/layout.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def primitive_cast(pedb, edb_object):
8080
class Layout(ObjBase):
8181
def __init__(self, pedb, edb_object):
8282
super().__init__(pedb, edb_object)
83+
self._primitives = []
8384

8485
@property
8586
def cell(self):
@@ -230,7 +231,15 @@ def primitives(self):
230231
-------
231232
list of :class:`dotnet.database.dotnet.primitive.PrimitiveDotNet` cast objects.
232233
"""
233-
return [primitive_cast(self._pedb, p) for p in self._edb_object.Primitives if p]
234+
primitives = list(self._edb_object.Primitives)
235+
if len(primitives) != len(self._primitives):
236+
self._primitives = [primitive_cast(self._pedb, p) for p in primitives]
237+
return self._primitives
238+
239+
@property
240+
def primitives_by_aedt_name(self) -> dict:
241+
"""Primitives."""
242+
return {i.aedt_name: i for i in self.primitives}
234243

235244
@property
236245
def bondwires(self):

src/pyedb/dotnet/database/dotnet/database.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
from pyedb import __version__
2929
from pyedb.dotnet.database.general import convert_py_list_to_net_list
30-
from pyedb.edb_logger import pyedb_logger
3130
from pyedb.generic.general_methods import (
3231
env_path,
3332
env_path_student,
@@ -704,7 +703,6 @@ class EdbDotNet(object):
704703
"""Edb Dot Net Class."""
705704

706705
def __init__(self, edbversion, student_version=False):
707-
self._logger = pyedb_logger
708706
if not edbversion: # pragma: no cover
709707
try:
710708
edbversion = "20{}.{}".format(list_installed_ansysem()[0][-3:-1], list_installed_ansysem()[0][-1:])

src/pyedb/dotnet/database/edb_data/padstacks_data.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,8 +1807,14 @@ def aedt_name(self):
18071807

18081808
val = String("")
18091809
_, name = self._edb_padstackinstance.GetProductProperty(self._pedb.edb_api.ProductId.Designer, 11, val)
1810-
name = str(name).strip("'")
1811-
return name
1810+
aedt_name = str(name).strip("'")
1811+
if aedt_name == "":
1812+
if self.is_pin and self.component:
1813+
aedt_name = f"{self.component.name}-{self.component_pin}"
1814+
elif self.component_pin:
1815+
aedt_name = self.component_pin
1816+
self.aedt_name = aedt_name
1817+
return aedt_name
18121818

18131819
@aedt_name.setter
18141820
def aedt_name(self, value):

src/pyedb/dotnet/database/layout_validation.py

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
import re
2424

25-
from pyedb.dotnet.clr_module import String
2625
from pyedb.dotnet.database.edb_data.padstacks_data import EDBPadstackInstance
2726
from pyedb.dotnet.database.edb_data.primitives_data import Primitive
2827
from pyedb.generic.general_methods import generate_unique_name
@@ -304,38 +303,33 @@ def illegal_net_names(self, fix=False):
304303

305304
def illegal_rlc_values(self, fix=False):
306305
"""Find and fix RLC illegal values."""
307-
inductors = self._pedb.components.inductors
308306

309-
temp = []
310-
for k, v in inductors.items():
311-
componentProperty = v.edbcomponent.GetComponentProperty()
312-
model = componentProperty.GetModel().Clone()
313-
pinpairs = model.PinPairs
314-
315-
if not len(list(pinpairs)): # pragma: no cover
316-
temp.append(k)
317-
if fix:
318-
v.rlc_values = [0, 1, 0]
319-
320-
self._pedb._logger.info("Found {} inductors have no value.".format(len(temp)))
307+
for name, objs in {
308+
"inductors": self._pedb.components.inductors,
309+
"resistors": self._pedb.components.resistors,
310+
"capacitors": self._pedb.components.capacitors,
311+
}.items():
312+
temp = []
313+
for k, v in objs.items():
314+
componentProperty = v.edbcomponent.GetComponentProperty()
315+
model = componentProperty.GetModel().Clone()
316+
pinpairs = model.PinPairs
317+
318+
if not len(list(pinpairs)): # pragma: no cover
319+
temp.append(k)
320+
if fix:
321+
v.rlc_values = [0, 1, 0]
322+
323+
self._pedb._logger.info(f"Found {len(temp)} {name} have no value.")
321324
return
322325

323326
def padstacks_no_name(self, fix=False):
327+
"""Find and fix padstacks without aedt_name."""
324328
pds = self._pedb.layout.padstack_instances
325329
counts = 0
326-
via_count = 1
327330
for obj in pds:
328-
val = String("")
329-
_, name = obj._edb_object.GetProductProperty(self._pedb.edb_api.ProductId.Designer, 11, val)
330-
name = str(name).strip("'")
331-
if name == "":
331+
if obj.aedt_name == "":
332332
counts += 1
333333
if fix:
334-
if not obj.component:
335-
obj._edb_object.SetProductProperty(self._pedb.edb_api.ProductId.Designer, 11, f"Via{via_count}")
336-
via_count = via_count + 1
337-
else:
338-
obj._edb_object.SetProductProperty(
339-
self._pedb.edb_api.ProductId.Designer, 11, f"{obj.component.name}-{obj.component_pin}"
340-
)
334+
obj.aedt_name = f"via_{obj.id}"
341335
self._pedb._logger.info(f"Found {counts}/{len(pds)} padstacks have no name.")

src/pyedb/dotnet/database/modeler.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ def __getitem__(self, name):
6767

6868
def __init__(self, p_edb):
6969
self._pedb = p_edb
70-
self._primitives = []
7170

7271
@property
7372
def _edb(self):

src/pyedb/dotnet/database/stackup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,7 +2234,7 @@ def _add_materials_from_dictionary(self, material_dict):
22342234
material.loss_tanget = material_properties["DielectricLossTangent"]
22352235
return True
22362236

2237-
def _import_xml(self, file_path, rename=False):
2237+
def _import_xml(self, file_path):
22382238
"""Read external xml file and convert into json file.
22392239
You can use xml file to import layer stackup but using json file is recommended.
22402240
see :class:`pyedb.dotnet.database.edb_data.simulation_configuration.SimulationConfiguration´ class to
@@ -2304,7 +2304,8 @@ def _import_xml(self, file_path, rename=False):
23042304
layers.append(layer)
23052305
stackup_dict["layers"] = layers
23062306
cfg = {"stackup": stackup_dict}
2307-
return self._pedb.configuration.load(cfg, apply_file=True)
2307+
self._pedb.configuration.load(cfg)
2308+
return self._pedb.configuration.run()
23082309

23092310
def _export_xml(self, file_path):
23102311
"""Export stackup information to an external XMLfile.
@@ -2391,7 +2392,7 @@ def load(self, file_path, rename=False):
23912392
elif file_path.endswith(".json"):
23922393
return self._import_json(file_path, rename=rename)
23932394
elif file_path.endswith(".xml"):
2394-
return self._import_xml(file_path, rename=rename)
2395+
return self._import_xml(file_path)
23952396
else:
23962397
return False
23972398

0 commit comments

Comments
 (0)