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 425ea761ff
commit d8889c3ca4
27 changed files with 109 additions and 60 deletions

View File

@@ -66,6 +66,7 @@ class _Project(ArchIFC.IfcContext):
def __init__(self, obj):
obj.Proxy = self
self.Type = "Project"
self.setProperties(obj)
obj.IfcType = "Project"
@@ -80,12 +81,19 @@ class _Project(ArchIFC.IfcContext):
pl = obj.PropertiesList
if not hasattr(obj,"Group"):
obj.addExtension("App::GroupExtensionPython")
self.Type = "Project"
def onDocumentRestored(self, obj):
"""Method run when the document is restored. Re-add the properties."""
self.setProperties(obj)
def dumps(self):
return None
def loads(self,state):
self.Type = "Project"
def addObject(self,obj,child):
"Adds an object to the group of this BuildingPart"