Fix #3138. Remove manual copy class and be more intelligent about what classe can be reassigned.

This commit is contained in:
Dion Moult
2023-05-29 17:20:55 +10:00
parent 6169b44fbd
commit 4d01dfe379
2 changed files with 12 additions and 2 deletions
@@ -44,6 +44,7 @@ class IfcClassData:
cls.data["name"] = cls.name()
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()
@classmethod
def ifc_products(cls):
@@ -172,3 +173,13 @@ class IfcClassData:
element = tool.Ifc.get_entity(bpy.context.active_object)
if element:
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"])
op = row.operator("bim.select_ifc_class", text="", icon="RESTRICT_SELECT_OFF")
op.ifc_class = IfcClassData.data["ifc_class"]
row.operator("bim.copy_class", icon="DUPLICATE", 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="")
else:
ifc_predefined_types = root_prop.get_ifc_predefined_types(context.scene.BIMRootProperties, context)