mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 15:08:06 +00:00
Fix error not excluding annotations from other drawings after 3848a21
Mentioned in #5233 Also some refactor: - checking IfcProduct instead of IfcProject. Not sure when this issue occur in general but if it occurs then it might fail for other non-IfcProducts too, not just IfcProject - small performance optimization
This commit is contained in:
@@ -1669,20 +1669,17 @@ class Drawing(bonsai.core.tool.Drawing):
|
|||||||
elements = {e for e in (elements & base_elements) if e.is_a() != "IfcSpace"}
|
elements = {e for e in (elements & base_elements) if e.is_a() != "IfcSpace"}
|
||||||
|
|
||||||
updated_set = set()
|
updated_set = set()
|
||||||
|
|
||||||
for i in elements:
|
for i in elements:
|
||||||
# exclude annotations to avoid including annotations from other drawings
|
# exclude annotations to avoid including annotations from other drawings
|
||||||
if not i.is_a("IfcAnnotation"):
|
if not i.is_a("IfcAnnotation"):
|
||||||
updated_set.add(i)
|
updated_set.add(i)
|
||||||
# add aggregate too, if element is host by one
|
# add aggregate too, if element is host by one
|
||||||
if i.Decomposes:
|
if decomposes := i.Decomposes:
|
||||||
aggregate = i.Decomposes[0].RelatingObject
|
aggregate = decomposes[0].RelatingObject
|
||||||
# remove IfcProject for class iterator. See https://github.com/IfcOpenShell/IfcOpenShell/issues/4361#issuecomment-2081223615
|
# remove IfcProject for class iterator. See https://github.com/IfcOpenShell/IfcOpenShell/issues/4361#issuecomment-2081223615
|
||||||
if not aggregate.is_a("IfcProject"):
|
if aggregate.is_a("IfcProduct"):
|
||||||
updated_set.add(aggregate)
|
updated_set.add(aggregate)
|
||||||
|
elements = updated_set
|
||||||
# After the iteration is complete, update elements with updated set
|
|
||||||
elements.update(updated_set)
|
|
||||||
|
|
||||||
# add annotations from the current drawing
|
# add annotations from the current drawing
|
||||||
annotations = tool.Drawing.get_group_elements(tool.Drawing.get_drawing_group(drawing))
|
annotations = tool.Drawing.get_group_elements(tool.Drawing.get_drawing_group(drawing))
|
||||||
|
|||||||
Reference in New Issue
Block a user