Skip to content

FIX: External circuit import of renamed sources #6128

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 10 commits into from
May 8, 2025
1 change: 1 addition & 0 deletions doc/changelog.d/6128.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
External circuit import of renamed sources
12 changes: 10 additions & 2 deletions src/ansys/aedt/core/maxwell.py
Original file line number Diff line number Diff line change
Expand Up @@ -2053,9 +2053,17 @@
sources_array, sources_type_array = [], []
for comp in oeditor.GetAllComponents():
if "Voltage Source" in oeditor.GetPropertyValue("ComponentTab", comp, "Description"):
comp_id = "V" + comp.split("@")[1].split(";")[1]
name = oeditor.GetPropertyValue("PassedParameterTab", comp, "Name")
if not name:
comp_id = "V" + comp.split("@")[1].split(";")[1]

Check warning on line 2058 in src/ansys/aedt/core/maxwell.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/maxwell.py#L2056-L2058

Added lines #L2056 - L2058 were not covered by tests
else:
comp_id = "V" + name

Check warning on line 2060 in src/ansys/aedt/core/maxwell.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/maxwell.py#L2060

Added line #L2060 was not covered by tests
elif "Current Source" in oeditor.GetPropertyValue("ComponentTab", comp, "Description"):
comp_id = "I" + comp.split("@")[1].split(";")[1]
name = oeditor.GetPropertyValue("PassedParameterTab", comp, "Name")
if not name:
comp_id = "I" + comp.split("@")[1].split(";")[1]

Check warning on line 2064 in src/ansys/aedt/core/maxwell.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/maxwell.py#L2062-L2064

Added lines #L2062 - L2064 were not covered by tests
else:
comp_id = "I" + name

Check warning on line 2066 in src/ansys/aedt/core/maxwell.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/maxwell.py#L2066

Added line #L2066 was not covered by tests
else:
continue

Expand Down
5 changes: 5 additions & 0 deletions tests/system/general/test_35_MaxwellCircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ def test_07_export_netlist(self, add_app):
assert m2d.edit_external_circuit(netlist_file, self.aedtapp.design_name)
with pytest.raises(AEDTRuntimeError):
m2d.edit_external_circuit(netlist_file, "invalid")
netlist_file_2 = os.path.join(self.local_scratch.path, "export_netlist_2.sph")
v_source.parameters["Name"] = "VSource"
i_source.parameters["Name"] = "ISource"
self.aedtapp.export_netlist_from_schematic(netlist_file_2)
assert m2d.edit_external_circuit(netlist_file_2, self.aedtapp.design_name)

def test_08_import_netlist(self):
self.aedtapp.insert_design("SchematicImport")
Expand Down