From 074de2741a673ae4a192bb814e67d1e73f6ccd2e Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 20 Oct 2023 12:24:57 +1100 Subject: [PATCH] Fix regression from 744c08e where type products cannot have an instance specified in create_shape --- src/blenderbim/blenderbim/tool/geometry.py | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/blenderbim/blenderbim/tool/geometry.py b/src/blenderbim/blenderbim/tool/geometry.py index fe55d3c590..8ca65ab73c 100644 --- a/src/blenderbim/blenderbim/tool/geometry.py +++ b/src/blenderbim/blenderbim/tool/geometry.py @@ -480,18 +480,27 @@ class Geometry(blenderbim.core.tool.Geometry): settings = ifcopenshell.geom.settings() settings.set(settings.WELD_VERTICES, True) context = representation.ContextOfItems - if element.is_a("IfcTypeProduct") or not apply_openings: - settings.set(settings.DISABLE_OPENING_SUBTRACTIONS, True) - if context.ContextIdentifier == "Body" and context.TargetView == "MODEL_VIEW": + if element.is_a("IfcTypeProduct"): + # You may only specify a single representation when creating shapes for types try: - shape = ifcopenshell.geom.create_shape(settings, element, representation) + shape = ifcopenshell.geom.create_shape(settings, representation) except: settings.set(settings.INCLUDE_CURVES, True) - shape = ifcopenshell.geom.create_shape(settings, element, representation) + shape = ifcopenshell.geom.create_shape(settings, representation) else: - settings.set(settings.INCLUDE_CURVES, True) - shape = ifcopenshell.geom.create_shape(settings, element, representation) + if not apply_openings: + settings.set(settings.DISABLE_OPENING_SUBTRACTIONS, True) + + if context.ContextIdentifier == "Body" and context.TargetView == "MODEL_VIEW": + try: + shape = ifcopenshell.geom.create_shape(settings, element, representation) + except: + settings.set(settings.INCLUDE_CURVES, True) + shape = ifcopenshell.geom.create_shape(settings, element, representation) + else: + settings.set(settings.INCLUDE_CURVES, True) + shape = ifcopenshell.geom.create_shape(settings, element, representation) ifc_importer = blenderbim.bim.import_ifc.IfcImporter(ifc_import_settings) ifc_importer.file = tool.Ifc.get()