add method to data class to retrieve ifc class name

This commit is contained in:
Gorgious
2022-01-28 07:41:59 +01:00
parent 7d6e1d80f2
commit e14b3b224e
2 changed files with 8 additions and 4 deletions
@@ -35,6 +35,7 @@ class AggregateData:
"has_aggregate": cls.has_aggregate(),
"label": cls.get_label(),
"relating_object_id": cls.get_relating_object_id(),
"ifc_class": cls.ifc_class(),
}
cls.is_loaded = True
@@ -53,3 +54,9 @@ class AggregateData:
aggregate = ifcopenshell.util.element.get_aggregate(tool.Ifc.get_entity(bpy.context.active_object))
if aggregate:
return aggregate.id()
@classmethod
def ifc_class(cls):
element = tool.Ifc.get_entity(bpy.context.active_object)
if element:
return element.is_a()
@@ -19,7 +19,6 @@
from bpy.types import Panel
from blenderbim.bim.module.aggregate.data import AggregateData
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.module.root.data import IfcClassData
class BIM_PT_aggregate(Panel):
@@ -73,8 +72,6 @@ class BIM_PT_aggregate(Panel):
row.operator("bim.enable_editing_aggregate", icon="GREASEPENCIL", text="")
row.operator("bim.add_aggregate", icon="ADD", text="")
if not IfcClassData.is_loaded:
IfcClassData.load()
ifc_class = IfcClassData.data["ifc_class"]
ifc_class = AggregateData.data["ifc_class"]
if ifc_class == "IfcBuilding":
layout.operator("bim.building_storey_add")