mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +00:00
You can now unlink blender objects to IFC ones. See #1222.
This commit is contained in:
@@ -7,6 +7,7 @@ classes = (
|
|||||||
operator.ReassignClass,
|
operator.ReassignClass,
|
||||||
operator.AssignClass,
|
operator.AssignClass,
|
||||||
operator.UnassignClass,
|
operator.UnassignClass,
|
||||||
|
operator.UnlinkObject,
|
||||||
prop.BIMRootProperties,
|
prop.BIMRootProperties,
|
||||||
ui.BIM_PT_class,
|
ui.BIM_PT_class,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -186,3 +186,20 @@ class UnassignClass(bpy.types.Operator):
|
|||||||
if "/" in obj.name and obj.name[0:3] == "Ifc":
|
if "/" in obj.name and obj.name[0:3] == "Ifc":
|
||||||
obj.name = "/".join(obj.name.split("/")[1:])
|
obj.name = "/".join(obj.name.split("/")[1:])
|
||||||
return {"FINISHED"}
|
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"])
|
name += "[{}]".format(data["PredefinedType"])
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text=name)
|
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.enable_reassign_class", icon="GREASEPENCIL", text="")
|
||||||
row.operator("bim.unassign_class", icon="X", text="").obj = context.active_object.name
|
row.operator("bim.unassign_class", icon="X", text="").obj = context.active_object.name
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user