Skip to content

Commit 27729ed

Browse files
committed
Ensure part uniqueness
1 parent f9a4ae6 commit 27729ed

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/compas/datastructures/assembly/assembly.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ def add_part(self, part, key=None, **kwargs):
8686
The identifier of the part in the current assembly graph.
8787
8888
"""
89+
if part.guid in self._parts:
90+
raise AssemblyError('Part already added to the assembly')
8991
key = self.graph.add_node(key=key, part=part, **kwargs)
9092
part.key = key
9193
self._parts[part.guid] = part

0 commit comments

Comments
 (0)