From 5f6ba27a9d20114d8bd5d0485e4584bcd1a83caa Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Tue, 3 Dec 2024 15:51:41 +0100 Subject: [PATCH] BIM: Fixed lock-unlock mode when opening IFC files - Fixes #18192 --- src/Mod/BIM/nativeifc/ifc_import.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Mod/BIM/nativeifc/ifc_import.py b/src/Mod/BIM/nativeifc/ifc_import.py index 10ee53fb10..a09b741366 100644 --- a/src/Mod/BIM/nativeifc/ifc_import.py +++ b/src/Mod/BIM/nativeifc/ifc_import.py @@ -49,7 +49,7 @@ def open(filename): doc = FreeCAD.newDocument() doc.Label = name FreeCAD.setActiveDocument(doc.Name) - insert(filename, doc.Name, singledoc=True) + insert(filename, doc.Name, singledoc=None) del FreeCAD.IsOpeningIFC QtCore.QTimer.singleShot(100, unset_modified) return doc @@ -62,9 +62,13 @@ def insert( shapemode=None, switchwb=None, silent=False, - singledoc=None, + singledoc=False, ): - """Inserts an IFC document in a FreeCAD document""" + """Inserts an IFC document in a FreeCAD document. + Singledoc defines if the produced result is a locked document or not. The + strategy is: + - When opening IFC files, locked/unlocked depends on the preferences (default locked) + - When inserting IFC files, always unlocked (an IFC doc object is created)""" from PySide import QtCore # lazy loading @@ -78,7 +82,7 @@ def insert( except: document = FreeCAD.newDocument() if singledoc is None: - singledoc = PARAMS.GetBool("SingleDoc", False) + singledoc = PARAMS.GetBool("SingleDoc", True) if singledoc: prj_obj = ifc_tools.convert_document(document, filename, shapemode, strategy) QtCore.QTimer.singleShot(100, toggle_lock_on)