diff --git a/src/bonsai/bonsai/bim/module/drawing/operator.py b/src/bonsai/bonsai/bim/module/drawing/operator.py index 28f5a1781a..6cdb8bb80f 100644 --- a/src/bonsai/bonsai/bim/module/drawing/operator.py +++ b/src/bonsai/bonsai/bim/module/drawing/operator.py @@ -951,6 +951,12 @@ class CreateDrawing(bpy.types.Operator): tree = ifcopenshell.geom.tree() tree.enable_face_styles(True) + # Accumulated across every file in the loop below (main model plus any + # linked models) so the SHAPELY fill pass after the loop covers all of + # them, not just whichever file happened to be processed last. + raycast_objs = set() + elements_with_faces = set() + for ifc_path, (ifc, link_matrix) in files.items(): # Don't use draw.main() just whilst we're prototyping and experimenting # TODO: hash paths are never used @@ -960,6 +966,15 @@ class CreateDrawing(bpy.types.Operator): self.serialiser.setFile(ifc) drawing_elements = tool.Drawing.get_drawing_elements(self.camera_element, ifc_file=ifc) + if self.cprops.fill_mode == "SHAPELY": + for element in drawing_elements.copy(): + if element.is_a("IfcAnnotation"): + continue + obj = tool.Ifc.get_object(element) + if obj and obj.type == "MESH" and len(obj.data.polygons): + elements_with_faces.add(element.GlobalId) + raycast_objs.add(obj) + # Get all representation contexts to see what we're dealing with. # Drawings only draw bodies and annotations (and facetation, due to a Revit bug). # A drawing prioritises a target view context first, followed by a model view context as a fallback. @@ -1033,16 +1048,6 @@ class CreateDrawing(bpy.types.Operator): # shapely variant group = root.find("{http://www.w3.org/2000/svg}g") - raycast_objs = set() - elements_with_faces = set() - for element in drawing_elements.copy(): - if element.is_a("IfcAnnotation"): - continue - obj = tool.Ifc.get_object(element) - if obj and obj.type == "MESH" and len(obj.data.polygons): - elements_with_faces.add(element.GlobalId) - raycast_objs.add(obj) - projections = root.xpath( ".//svg:g[contains(@class, 'projection')]", namespaces={"svg": "http://www.w3.org/2000/svg"} )