mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 21:58:46 +00:00
Add feature to explode an aggregation.
This commit is contained in:
@@ -71,6 +71,7 @@ if bpy is not None:
|
|||||||
operator.CreateAggregate,
|
operator.CreateAggregate,
|
||||||
operator.EditAggregate,
|
operator.EditAggregate,
|
||||||
operator.SaveAggregate,
|
operator.SaveAggregate,
|
||||||
|
operator.ExplodeAggregate,
|
||||||
operator.AssignClassification,
|
operator.AssignClassification,
|
||||||
operator.UnassignClassification,
|
operator.UnassignClassification,
|
||||||
operator.RemoveClassification,
|
operator.RemoveClassification,
|
||||||
|
|||||||
@@ -671,6 +671,26 @@ class SaveAggregate(bpy.types.Operator):
|
|||||||
obj.hide_viewport = False
|
obj.hide_viewport = False
|
||||||
return {'FINISHED'}
|
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):
|
class AssignClassification(bpy.types.Operator):
|
||||||
bl_idname = 'bim.assign_classification'
|
bl_idname = 'bim.assign_classification'
|
||||||
bl_label = 'Assign Classification'
|
bl_label = 'Assign Classification'
|
||||||
|
|||||||
@@ -352,8 +352,10 @@ class BIM_PT_bim(Panel):
|
|||||||
row.prop(bim_properties, "aggregate_class")
|
row.prop(bim_properties, "aggregate_class")
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.prop(bim_properties, "aggregate_name")
|
row.prop(bim_properties, "aggregate_name")
|
||||||
row = layout.row()
|
|
||||||
|
row = layout.row(align=True)
|
||||||
row.operator("bim.create_aggregate")
|
row.operator("bim.create_aggregate")
|
||||||
|
row.operator("bim.explode_aggregate")
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.operator("bim.edit_aggregate")
|
row.operator("bim.edit_aggregate")
|
||||||
|
|||||||
Reference in New Issue
Block a user