Skip to content

Commit 9f0b2b0

Browse files
vpipidispyansys-ci-botpre-commit-ci[bot]Samuelopez-ansys
authored
FIX: External circuit import of renamed sources (#6128)
Co-authored-by: pyansys-ci-bot <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Samuel Lopez <[email protected]>
1 parent c0d232a commit 9f0b2b0

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

doc/changelog.d/6128.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
External circuit import of renamed sources

src/ansys/aedt/core/maxwell.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2053,9 +2053,17 @@ def edit_external_circuit(self, netlist_file_path, schematic_design_name=None, p
20532053
sources_array, sources_type_array = [], []
20542054
for comp in oeditor.GetAllComponents():
20552055
if "Voltage Source" in oeditor.GetPropertyValue("ComponentTab", comp, "Description"):
2056-
comp_id = "V" + comp.split("@")[1].split(";")[1]
2056+
name = oeditor.GetPropertyValue("PassedParameterTab", comp, "Name")
2057+
if not name:
2058+
comp_id = "V" + comp.split("@")[1].split(";")[1]
2059+
else:
2060+
comp_id = "V" + name
20572061
elif "Current Source" in oeditor.GetPropertyValue("ComponentTab", comp, "Description"):
2058-
comp_id = "I" + comp.split("@")[1].split(";")[1]
2062+
name = oeditor.GetPropertyValue("PassedParameterTab", comp, "Name")
2063+
if not name:
2064+
comp_id = "I" + comp.split("@")[1].split(";")[1]
2065+
else:
2066+
comp_id = "I" + name
20592067
else:
20602068
continue
20612069

tests/system/general/test_35_MaxwellCircuit.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ def test_07_export_netlist(self, add_app):
113113
assert m2d.edit_external_circuit(netlist_file, self.aedtapp.design_name)
114114
with pytest.raises(AEDTRuntimeError):
115115
m2d.edit_external_circuit(netlist_file, "invalid")
116+
netlist_file_2 = os.path.join(self.local_scratch.path, "export_netlist_2.sph")
117+
v_source.parameters["Name"] = "VSource"
118+
i_source.parameters["Name"] = "ISource"
119+
self.aedtapp.export_netlist_from_schematic(netlist_file_2)
120+
assert m2d.edit_external_circuit(netlist_file_2, self.aedtapp.design_name)
116121

117122
def test_08_import_netlist(self):
118123
self.aedtapp.insert_design("SchematicImport")

0 commit comments

Comments
 (0)