Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: layout validation padstack names #847

Merged
merged 5 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/pyedb/configuration/cfg_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ def __init__(self, pedb, components_data):
self.components = [CfgComponent(**comp) for comp in components_data]

def apply(self):
comps_in_db = self._pedb.components.components
comps_in_db = self._pedb.components
for comp in self.components:
c_db = comps_in_db[comp.reference_designator]
c_db = comps_in_db.instances[comp.reference_designator]
if comp.definition:
c_db.definition = comp.definition
if comp.type:
Expand Down
18 changes: 14 additions & 4 deletions src/pyedb/configuration/cfg_padstacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,21 @@ def get_data_from_db(self):
definitions.append(i.get_attributes())
data["definitions"] = definitions

instances_layout = self._pedb.padstacks.instances_by_name
for name, obj in instances_layout.items():
for obj in self._pedb.layout.padstack_instances:
temp = obj.properties
self.instances.append(
Instance(name=name, definition=obj.padstack_definition, backdrill_parameters=obj.backdrill_parameters)
Instance(
name=temp["name"],
definition=temp["definition"],
backdrill_parameters=temp["backdrill_parameters"],
id=temp["id"],
position=temp["position"],
rotation=temp["rotation"],
)
)
instances = []
for i in self.instances:
instances.append(i.get_attributes())
instances.append(i.get_attributes("id"))
data["instances"] = instances
return data

Expand All @@ -104,3 +111,6 @@ def __init__(self, **kwargs):
self.name = kwargs["name"]
self.definition = kwargs.get("definition", None)
self.backdrill_parameters = kwargs.get("backdrill_parameters", None)
self.id = kwargs.get("id", None)
self.position = kwargs.get("position", [])
self.rotation = kwargs.get("rotation", None)
12 changes: 12 additions & 0 deletions src/pyedb/dotnet/edb_core/edb_data/padstacks_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2324,3 +2324,15 @@ def get_reference_pins(self, reference_net="GND", search_radius=5e-3, max_limit=
max_limit=max_limit,
component_only=component_only,
)

@property
def properties(self):
data = {}
data["name"] = self.aedt_name
data["definition"] = self.padstack_definition
data["backdrill_parameters"] = self.backdrill_parameters
_, position, rotation = self._edb_object.GetPositionAndRotationValue()
data["position"] = [position.X.ToString(), position.Y.ToString()]
data["rotation"] = [rotation.ToString()]
data["id"] = self.id
return data
23 changes: 23 additions & 0 deletions src/pyedb/dotnet/edb_core/layout_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import re

from pyedb.dotnet.clr_module import String
from pyedb.dotnet.edb_core.edb_data.padstacks_data import EDBPadstackInstance
from pyedb.dotnet.edb_core.edb_data.primitives_data import Primitive
from pyedb.generic.general_methods import generate_unique_name
Expand Down Expand Up @@ -318,3 +319,25 @@ def illegal_rlc_values(self, fix=False):

self._pedb._logger.info("Found {} inductors have no value.".format(len(temp)))
return

def padstacks_no_name(self, fix=False):
pds = self._pedb.layout.padstack_instances
counts = 0
via_count = 1
for obj in pds:
val = String("")
_, name = obj._edb_object.GetProductProperty(self._pedb.edb_api.ProductId.Designer, 11, val)
name = str(name).strip("'")
if name == "":
counts += 1
if fix:
if not obj.component:
obj._edb_object.SetProductProperty(
self._pedb.edb_api.ProductId.Designer, 11, f"via_{via_count}"
)
via_count = via_count + 1
else:
obj._edb_object.SetProductProperty(
self._pedb.edb_api.ProductId.Designer, 11, f"{obj.component.name}-{obj.component_pin}"
)
self._pedb._logger.info(f"Found {counts}/{len(pds)} padstacks have no name.")
6 changes: 5 additions & 1 deletion src/pyedb/siwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,13 +555,15 @@ def load_configuration(self, file_path: str):
self.import_edb(temp_edb)
shutil.rmtree(Path(temp_edb), ignore_errors=True)

def export_configuration(self, file_path: str):
def export_configuration(self, file_path: str, fix_padstack_names: bool = False):
"""Export layout information into a configuration file.

Parameters
----------
file_path : str
Path to the configuration file.
fix_padstack_names : bool
Name all the padstacks in edb.
"""
file_path = parser_file_path(file_path)

Expand All @@ -570,5 +572,7 @@ def export_configuration(self, file_path: str):

self.export_edb(temp_edb)
edbapp = Edb(temp_edb, edbversion=self.current_version)
if fix_padstack_names:
edbapp.layout_validation.padstacks_no_name(fix=True)
edbapp.configuration.export(file_path)
edbapp.close()
Loading