Skip to content

Commit

Permalink
enhance assign_voltage maxwell (#4433)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmalinve authored Apr 1, 2024
1 parent cb3ce4d commit 610521b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions _unittest/test_28_Maxwell3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ def test_32_matrix(self, add_app):
rectangle4 = m3d.modeler.create_rectangle(0, [32.5, 1.5, 0], [2.5, 5], name="Sheet4")

m3d.assign_voltage(rectangle1.faces[0], amplitude=1, name="Voltage1")
m3d.assign_voltage("Sheet1", amplitude=1, name="Voltage5")
m3d.assign_voltage(rectangle2.faces[0], amplitude=1, name="Voltage2")
m3d.assign_voltage(rectangle3.faces[0], amplitude=1, name="Voltage3")
m3d.assign_voltage(rectangle4.faces[0], amplitude=1, name="Voltage4")
Expand Down
8 changes: 7 additions & 1 deletion pyaedt/maxwell.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,13 @@ def assign_voltage(self, face_list, amplitude=1, name=None):
if self.design_type == "Maxwell 2D":
props = OrderedDict({"Objects": face_list, "Value": amplitude})
else:
props = OrderedDict({"Faces": face_list, "Voltage": amplitude})
if len(face_list) == 1:
if isinstance(face_list[0], str) and face_list[0] in self.modeler.object_names:
props = OrderedDict({"Objects": face_list, "Voltage": amplitude})
else:
props = OrderedDict({"Faces": face_list, "Value": amplitude})
else:
props = OrderedDict({"Faces": face_list, "Voltage": amplitude})
bound = BoundaryObject(self, name, props, "Voltage")
if bound.create():
self._boundaries[bound.name] = bound
Expand Down

0 comments on commit 610521b

Please sign in to comment.