Add feature to explode an aggregation.

This commit is contained in:
Dion Moult
2020-01-08 15:58:39 +11:00
parent f11021b505
commit 579d3d9f86
3 changed files with 24 additions and 1 deletions
@@ -71,6 +71,7 @@ if bpy is not None:
operator.CreateAggregate,
operator.EditAggregate,
operator.SaveAggregate,
operator.ExplodeAggregate,
operator.AssignClassification,
operator.UnassignClassification,
operator.RemoveClassification,
@@ -671,6 +671,26 @@ class SaveAggregate(bpy.types.Operator):
obj.hide_viewport = False
return {'FINISHED'}
class ExplodeAggregate(bpy.types.Operator):
bl_idname = 'bim.explode_aggregate'
bl_label = 'Explode Aggregate'
def execute(self, context):
obj = bpy.context.active_object
if obj.instance_type != 'COLLECTION' \
or 'IfcRelAggregates' not in obj.instance_collection.name:
return {'FINISHED'}
aggregate_collection = bpy.data.collections.get(obj.instance_collection.name)
spatial_collection = obj.users_collection[0]
for part in aggregate_collection.objects:
spatial_collection.objects.link(part)
aggregate_collection.objects.unlink(part)
bpy.data.objects.remove(obj, do_unlink=True)
bpy.data.collections.remove(aggregate_collection, do_unlink=True)
return {'FINISHED'}
class AssignClassification(bpy.types.Operator):
bl_idname = 'bim.assign_classification'
bl_label = 'Assign Classification'
+3 -1
View File
@@ -352,8 +352,10 @@ class BIM_PT_bim(Panel):
row.prop(bim_properties, "aggregate_class")
row = layout.row()
row.prop(bim_properties, "aggregate_name")
row = layout.row()
row = layout.row(align=True)
row.operator("bim.create_aggregate")
row.operator("bim.explode_aggregate")
row = layout.row(align=True)
row.operator("bim.edit_aggregate")