From bda260336cdc5d9064ffda4412d49e07570f9951 Mon Sep 17 00:00:00 2001 From: tetektoza Date: Sun, 11 May 2025 16:39:29 +0200 Subject: [PATCH] BIM: Fix missing IFC attributes for certain BIM objects Some of the objects, like Column, or Beam do not contain `IFC Attributes` if they are initially created. As it turns out, they are not being created as we are checking for `onDocRestoredDone` attribute, which is assigned in `onDocumentRestored` function. Since users can usually just not restore a document, but just play on a newly created document, this attribute won't be available, thus we won't be going through whole `onChanged` logic which populates `IFC Attributes`. To preserve current functionality of this additional parameter and not cause the previous errors to happen, this patch just changes from the custom flag to globally available `Restoring` flag which tracks document being restored more reliably. --- src/Mod/BIM/ArchStructure.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Mod/BIM/ArchStructure.py b/src/Mod/BIM/ArchStructure.py index 49d1c95c00..46b7b181b1 100644 --- a/src/Mod/BIM/ArchStructure.py +++ b/src/Mod/BIM/ArchStructure.py @@ -772,7 +772,6 @@ class _Structure(ArchComponent.Component): obj.setEditorMode("ArchSketchPropertySet", ["ReadOnly"]) # set a flag to indicate onDocumentRestored() is run - self.onDocRestoredDone = True def execute(self,obj): @@ -1086,10 +1085,10 @@ class _Structure(ArchComponent.Component): def onChanged(self,obj,prop): - # check the flag indicating if onDocumentRestored() has been run; if - # not, no further code is run - as getExtrusionData() below return - # error when some properties are not added by onDocumentRestored() - if not hasattr(self,"onDocRestoredDone"): + # check the flag indicating if we are currently in the process of + # restoring document; if not, no further code is run as getExtrusionData() + # below return error when some properties are not added by onDocumentRestored() + if FreeCAD.ActiveDocument.Restoring: return if hasattr(obj,"IfcType"):