mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +00:00
Fix #3138. Remove manual copy class and be more intelligent about what classe can be reassigned.
This commit is contained in:
@@ -44,6 +44,7 @@ class IfcClassData:
|
|||||||
cls.data["name"] = cls.name()
|
cls.data["name"] = cls.name()
|
||||||
cls.data["ifc_class"] = cls.ifc_class()
|
cls.data["ifc_class"] = cls.ifc_class()
|
||||||
cls.data["ifc_predefined_types"] = cls.ifc_predefined_types()
|
cls.data["ifc_predefined_types"] = cls.ifc_predefined_types()
|
||||||
|
cls.data["can_reassign_class"] = cls.can_reassign_class()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def ifc_products(cls):
|
def ifc_products(cls):
|
||||||
@@ -172,3 +173,13 @@ class IfcClassData:
|
|||||||
element = tool.Ifc.get_entity(bpy.context.active_object)
|
element = tool.Ifc.get_entity(bpy.context.active_object)
|
||||||
if element:
|
if element:
|
||||||
return element.is_a()
|
return element.is_a()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def can_reassign_class(cls):
|
||||||
|
element = tool.Ifc.get_entity(bpy.context.active_object)
|
||||||
|
if element:
|
||||||
|
if element.is_a("IfcOpeningElement") or element.is_a("IfcOpeningStandardCase"):
|
||||||
|
return False
|
||||||
|
for product in cls.ifc_products():
|
||||||
|
if element.is_a(product[0]):
|
||||||
|
return True
|
||||||
|
|||||||
@@ -62,9 +62,8 @@ class BIM_PT_class(Panel):
|
|||||||
row.label(text=IfcClassData.data["name"])
|
row.label(text=IfcClassData.data["name"])
|
||||||
op = row.operator("bim.select_ifc_class", text="", icon="RESTRICT_SELECT_OFF")
|
op = row.operator("bim.select_ifc_class", text="", icon="RESTRICT_SELECT_OFF")
|
||||||
op.ifc_class = IfcClassData.data["ifc_class"]
|
op.ifc_class = IfcClassData.data["ifc_class"]
|
||||||
row.operator("bim.copy_class", icon="DUPLICATE", text="")
|
|
||||||
row.operator("bim.unlink_object", icon="UNLINKED", text="")
|
row.operator("bim.unlink_object", icon="UNLINKED", text="")
|
||||||
if IfcStore.get_file().by_id(props.ifc_definition_id).is_a("IfcRoot"):
|
if IfcClassData.data["can_reassign_class"]:
|
||||||
row.operator("bim.enable_reassign_class", icon="GREASEPENCIL", text="")
|
row.operator("bim.enable_reassign_class", icon="GREASEPENCIL", text="")
|
||||||
else:
|
else:
|
||||||
ifc_predefined_types = root_prop.get_ifc_predefined_types(context.scene.BIMRootProperties, context)
|
ifc_predefined_types = root_prop.get_ifc_predefined_types(context.scene.BIMRootProperties, context)
|
||||||
|
|||||||
Reference in New Issue
Block a user