You can now unlink blender objects to IFC ones. See #1222.

This commit is contained in:
Dion Moult
2021-01-27 15:41:24 +11:00
parent c0ed4074d8
commit c472dc2f1b
3 changed files with 19 additions and 0 deletions
@@ -7,6 +7,7 @@ classes = (
operator.ReassignClass,
operator.AssignClass,
operator.UnassignClass,
operator.UnlinkObject,
prop.BIMRootProperties,
ui.BIM_PT_class,
)
@@ -186,3 +186,20 @@ class UnassignClass(bpy.types.Operator):
if "/" in obj.name and obj.name[0:3] == "Ifc":
obj.name = "/".join(obj.name.split("/")[1:])
return {"FINISHED"}
class UnlinkObject(bpy.types.Operator):
bl_idname = "bim.unlink_object"
bl_label = "Unlink Object"
obj: bpy.props.StringProperty()
def execute(self, context):
self.file = IfcStore.get_file()
if self.obj:
objects = [bpy.data.objects.get(self.obj)]
else:
objects = bpy.context.selected_objects
for obj in objects:
if obj.BIMObjectProperties.ifc_definition_id:
obj.BIMObjectProperties.ifc_definition_id = 0
return {"FINISHED"}
@@ -34,6 +34,7 @@ class BIM_PT_class(Panel):
name += "[{}]".format(data["PredefinedType"])
row = self.layout.row(align=True)
row.label(text=name)
row.operator("bim.unlink_object", icon="UNLINKED", text="").obj = context.active_object.name
row.operator("bim.enable_reassign_class", icon="GREASEPENCIL", text="")
row.operator("bim.unassign_class", icon="X", text="").obj = context.active_object.name
else: