BIM: Fixed lock-unlock mode when opening IFC files - Fixes #18192

This commit is contained in:
Yorik van Havre
2024-12-03 15:51:41 +01:00
committed by Yorik van Havre
parent 6d58b6e7b1
commit 5f6ba27a9d

View File

@@ -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)