Fix error reassigning class for structural items

This commit is contained in:
Andrej730
2025-02-24 15:10:10 +05:00
parent 5fa0aa03e4
commit 57d6e9b544
3 changed files with 28 additions and 31 deletions
+1 -20
View File
@@ -54,27 +54,8 @@ class IfcClassData:
@classmethod
def ifc_products(cls):
products = [
"IfcElementType",
"IfcElement",
"IfcFeatureElement",
"IfcSpatialElement",
"IfcSpatialElementType",
"IfcStructuralItem",
"IfcAnnotation",
"IfcRelSpaceBoundary",
]
products = tool.Root.get_ifc_products()
version = tool.Ifc.get_schema()
if version == "IFC2X3":
products = [
"IfcElementType",
"IfcElement",
"IfcFeatureElement",
"IfcSpatialStructureElement",
"IfcStructuralItem",
"IfcAnnotation",
"IfcRelSpaceBoundary",
]
return [(e, e, (get_entity_doc(version, e) or {}).get("description", "")) for e in products]
@classmethod
+1 -11
View File
@@ -48,17 +48,7 @@ class EnableReassignClass(bpy.types.Operator):
assert element
ifc_class = element.is_a()
context.active_object.BIMObjectProperties.is_reassigning_class = True
ifc_products = [
"IfcElement",
"IfcElementType",
"IfcSpatialElement",
"IfcGroup",
"IfcStructural",
"IfcPositioningElement",
"IfcContext",
"IfcAnnotation",
"IfcRelSpaceBoundary",
]
ifc_products = tool.Root.get_ifc_products()
schema = tool.Ifc.schema()
declaration = schema.declaration_by_name(ifc_class)
for ifc_product in ifc_products:
+26
View File
@@ -429,3 +429,29 @@ class Root(bonsai.core.tool.Root):
tool.Ifc.unlink(obj=material)
if "Ifc" in obj.name and "/" in obj.name:
obj.name = obj.name.split("/", 1)[1]
@classmethod
def get_ifc_products(cls) -> tuple[str, ...]:
version = tool.Ifc.get_schema()
if version == "IFC2X3":
products = (
"IfcElementType",
"IfcElement",
"IfcFeatureElement",
"IfcSpatialStructureElement",
"IfcStructuralItem",
"IfcAnnotation",
"IfcRelSpaceBoundary",
)
else:
products = (
"IfcElementType",
"IfcElement",
"IfcFeatureElement",
"IfcSpatialElement",
"IfcSpatialElementType",
"IfcStructuralItem",
"IfcAnnotation",
"IfcRelSpaceBoundary",
)
return products