From 4ef209cabea37253a4533e13c0797de5adc1228c Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Thu, 23 Oct 2025 12:02:06 +0200 Subject: [PATCH] BIM: fix strict IFC drag and drop --- src/Mod/BIM/nativeifc/ifc_tools.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Mod/BIM/nativeifc/ifc_tools.py b/src/Mod/BIM/nativeifc/ifc_tools.py index 7c2cfd755d..2f55339a91 100644 --- a/src/Mod/BIM/nativeifc/ifc_tools.py +++ b/src/Mod/BIM/nativeifc/ifc_tools.py @@ -1205,6 +1205,7 @@ def aggregate(obj, parent, mode=None): if not ifcfile: return product = None + objecttype = None new = False stepid = getattr(obj, "StepId", None) if stepid: @@ -1217,13 +1218,12 @@ def aggregate(obj, parent, mode=None): pass if product: # this object already has an associated IFC product - print("DEBUG:", obj.Label, "is already part of the IFC document") + # print("DEBUG:", obj.Label, "is already part of the IFC document") newobj = obj else: ifcclass = None if mode == "opening": ifcclass = "IfcOpeningElement" - objecttype = None if ifc_export.is_annotation(obj): product = ifc_export.create_annotation(obj, ifcfile) if Draft.get_type(obj) in ["DraftText", "Text"]: @@ -1234,9 +1234,13 @@ def aggregate(obj, parent, mode=None): else: product = ifc_export.create_product(obj, parent, ifcfile, ifcclass) if product: - shapemode = getattr(parent, "ShapeMode", DEFAULT_SHAPEMODE) - newobj = create_object(product, obj.Document, ifcfile, shapemode, objecttype) - new = True + exobj = get_object(product, obj.Document) + if exobj is None: + shapemode = getattr(parent, "ShapeMode", DEFAULT_SHAPEMODE) + newobj = create_object(product, obj.Document, ifcfile, shapemode, objecttype) + new = True + else: + newobj = exobj create_relationship(obj, newobj, parent, product, ifcfile, mode) base = getattr(obj, "Base", None) if base: