mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 22:11:36 +00:00
Fix #4484. Clarify inheritance rules of predefined types.
This commit is contained in:
@@ -42,6 +42,7 @@ class IfcClassData:
|
||||
cls.data["contexts"] = cls.contexts()
|
||||
cls.data["has_entity"] = cls.has_entity()
|
||||
cls.data["name"] = cls.name()
|
||||
cls.data["has_inherited_predefined_type"] = cls.has_inherited_predefined_type()
|
||||
cls.data["ifc_class"] = cls.ifc_class()
|
||||
cls.data["ifc_predefined_types"] = cls.ifc_predefined_types()
|
||||
cls.data["can_reassign_class"] = cls.can_reassign_class()
|
||||
@@ -162,6 +163,15 @@ class IfcClassData:
|
||||
name += f"[{predefined_type}]"
|
||||
return name
|
||||
|
||||
@classmethod
|
||||
def has_inherited_predefined_type(cls):
|
||||
element = tool.Ifc.get_entity(bpy.context.view_layer.objects.active)
|
||||
if not element:
|
||||
return
|
||||
if element_type := ifcopenshell.util.element.get_type(element):
|
||||
return ifcopenshell.util.element.get_predefined_type(element_type) != "NOTDEFINED"
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def ifc_class(cls):
|
||||
element = tool.Ifc.get_entity(bpy.context.view_layer.objects.active)
|
||||
|
||||
@@ -61,7 +61,10 @@ class BIM_PT_class(Panel):
|
||||
self.layout.prop(context.scene.BIMRootProperties, "relating_class_object", icon="COPYDOWN")
|
||||
else:
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text=IfcClassData.data["name"])
|
||||
row.label(
|
||||
text=IfcClassData.data["name"],
|
||||
icon="CON_CHILDOF" if IfcClassData.data["has_inherited_predefined_type"] else "NONE",
|
||||
)
|
||||
row.operator("bim.select_ifc_class", text="", icon="RESTRICT_SELECT_OFF")
|
||||
row.operator("bim.unlink_object", icon="UNLINKED", text="")
|
||||
if IfcClassData.data["can_reassign_class"]:
|
||||
|
||||
Reference in New Issue
Block a user