BIM: fix setting of self.Type

Fixes #21364.

`self.Type` should be set in `__init__` and `loads`, and not in `onDocumentRestored`.

Additionally:
fixed mistake in `loads` in ifc_objects.py.
This commit is contained in:
Roy-043
2025-06-26 13:58:12 +02:00
committed by Chris Hennes
parent 8add557e2f
commit 90a6bb7ea4
27 changed files with 109 additions and 60 deletions

View File

@@ -185,8 +185,8 @@ class Component(ArchIFC.IfcProduct):
def __init__(self, obj):
obj.Proxy = self
Component.setProperties(self, obj)
self.Type = "Component"
Component.setProperties(self,obj)
def setProperties(self, obj):
"""Give the component its component specific properties, such as material.
@@ -240,7 +240,6 @@ class Component(ArchIFC.IfcProduct):
self.Subvolume = None
#self.MoveWithHost = False
self.Type = "Component"
def onDocumentRestored(self, obj):
"""Method run when the document is restored. Re-add the Arch component properties.
@@ -277,13 +276,10 @@ class Component(ArchIFC.IfcProduct):
obj.Shape = shape
def dumps(self):
# for compatibility with 0.17
if hasattr(self,"Type"):
return self.Type
return "Component"
return None
def loads(self,state):
return None
self.Type = "Component"
def onBeforeChange(self,obj,prop):
"""Method called before the object has a property changed.