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.
This commit is contained in:
committed by
Yorik van Havre
parent
ca0630aa50
commit
bda260336c
@@ -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"):
|
||||
|
||||
Reference in New Issue
Block a user