Skip to content

Commit

Permalink
FIX: Check _object_names_to_ids keys are the same than existing objec…
Browse files Browse the repository at this point in the history
…t names (#5468)
  • Loading branch information
Samuelopez-ansys authored Nov 21, 2024
1 parent ca9c7b0 commit 3cccdeb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/modeler/cad/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ def cleanup_solids(self):
all_objects = self.object_names
all_unclassified = self.unclassified_names
all_objs = all_objects + all_unclassified
if len(all_objs) != len(self._object_names_to_ids):
if sorted(all_objs) != sorted(list(self._object_names_to_ids.keys())):
for old_id, obj in self.objects.items():
if obj.name in all_objs:
# Check if ID can change in boolean operations
Expand Down
10 changes: 10 additions & 0 deletions tests/system/general/test_07_Object3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ def test_01_delete_object(self):
assert not self.aedtapp.modeler[name]
assert not o.__dict__

# 1 body and 1 sheet
o1 = self.aedtapp.modeler.create_circle(orientation=0, origin=[0, 0, 0], radius=5)
name1 = o1.name
o2 = self.aedtapp.modeler.create_box(origin=[0, 0, 0], sizes=[10, 10, 10], material="vacuum")
name2 = o2.name
o2.delete()
assert not self.aedtapp.modeler[name2]
o1.delete()
assert not self.aedtapp.modeler[name1]

def test_01_subtract_object(self):
o1 = self.create_copper_box("subtract_box")
o2 = self.create_copper_sphere("subtract_sphere")
Expand Down

0 comments on commit 3cccdeb

Please sign in to comment.