Skip to content

FIX: improvements in circuit config #6012

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

Merged
merged 12 commits into from
May 8, 2025
1 change: 1 addition & 0 deletions doc/changelog.d/6012.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
improvements in circuit config
41 changes: 29 additions & 12 deletions src/ansys/aedt/core/generic/configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2322,15 +2322,24 @@
for k, l in pin_mapping.items():
temp_dict3 = {}
for i in l:
temp_dict3.update({i._circuit_comp.refdes: i.name})
if i._circuit_comp.refdes in temp_dict3.keys():
temp_dict3[i._circuit_comp.refdes].append(i.name)

Check warning on line 2326 in src/ansys/aedt/core/generic/configurations.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/generic/configurations.py#L2326

Added line #L2326 was not covered by tests
else:
temp_dict3.update({i._circuit_comp.refdes: [i.name]})
pin_mapping[k] = temp_dict3

port_dict = {}
temp = pin_mapping.copy()
for k, l in temp.items():
if k not in ["gnd", "ports"] and len(l) == 1:
if k not in port_dict.keys():
port_dict[k] = l
else:
port_dict[k].append(l)

Check warning on line 2338 in src/ansys/aedt/core/generic/configurations.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/generic/configurations.py#L2338

Added line #L2338 was not covered by tests
del pin_mapping[k]

dict_out.update(
{
"models": data_models,
"refdes": data_refdes,
"pin_mapping": pin_mapping,
}
{"models": data_models, "refdes": data_refdes, "pin_mapping": pin_mapping, "ports": port_dict}
) # Call private export method to update dict_out.

# update the json if it exists already
Expand Down Expand Up @@ -2450,22 +2459,30 @@
if new_comp_params.get(name, None) != parameter:
new_comp.parameters[name] = parameter

comp_list = list(self._app.modeler.schematic.components.values())
for i, j in data["pin_mapping"].items():
pins = []
for k, l in j.items():
for comp in list(self._app.modeler.schematic.components.values()):
if not comp.refdes:
continue
elif comp.refdes == k:
for comp in comp_list:
if comp.refdes == k:
for pin in comp.pins:
if pin.name == l:
if pin.name in l:
pins.append(pin)
if i == "gnd":
for gnd_pin in pins:
self._app.modeler.schematic.create_gnd(gnd_pin.location, gnd_pin.angle, page=i)
location = [x - y for x, y in zip(gnd_pin.location, [0, 0.00254])]
self._app.modeler.schematic.create_gnd(location, page=i)
elif len(pins) > 1:
pins[0].connect_to_component(pins[1:], page_name=i)

for i, j in data["ports"].items():
for k, l in j.items():
for comp in comp_list:
if comp.refdes == k:
for pin in comp.pins:
if pin.name in l:
self._app.modeler.schematic.create_interface_port(name=i, location=pin.location)

if self.options.import_setups and data.get("setups", None):
self.results.import_setup = True
for setup, props in data["setups"].items():
Expand Down
Loading