mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-19 03:33:48 +00:00
add method to data class to retrieve ifc class name
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user