mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
Fix bug where aggregate creation doesn't work if the aggregates collection doesn't exist
This commit is contained in:
@@ -1763,6 +1763,9 @@ class CreateAggregate(bpy.types.Operator):
|
|||||||
aggregate = bpy.data.collections.new('IfcRelAggregates/{}'.format(
|
aggregate = bpy.data.collections.new('IfcRelAggregates/{}'.format(
|
||||||
bpy.context.scene.BIMProperties.aggregate_class))
|
bpy.context.scene.BIMProperties.aggregate_class))
|
||||||
for project in [c for c in bpy.context.view_layer.layer_collection.children if 'IfcProject' in c.name]:
|
for project in [c for c in bpy.context.view_layer.layer_collection.children if 'IfcProject' in c.name]:
|
||||||
|
if not [c for c in project.children if 'Aggregates' in c.name]:
|
||||||
|
aggregates = bpy.data.collections.new('Aggregates')
|
||||||
|
project.collection.children.link(aggregates)
|
||||||
for aggregate_collection in [c for c in project.children if 'Aggregates' in c.name]:
|
for aggregate_collection in [c for c in project.children if 'Aggregates' in c.name]:
|
||||||
aggregate_collection.collection.children.link(aggregate)
|
aggregate_collection.collection.children.link(aggregate)
|
||||||
aggregate_collection.children[aggregate.name].hide_viewport = True
|
aggregate_collection.children[aggregate.name].hide_viewport = True
|
||||||
|
|||||||
Reference in New Issue
Block a user