mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 10:51:13 +00:00
Extract aggregate creation logic
This commit is contained in:
@@ -99,12 +99,7 @@ class AddAggregate(bpy.types.Operator):
|
|||||||
if not element:
|
if not element:
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
aggregate_collection = bpy.data.collections.new("IfcElementAssembly/Assembly")
|
aggregate = self.create_aggregate(context)
|
||||||
context.scene.collection.children.link(aggregate_collection)
|
|
||||||
aggregate = bpy.data.objects.new("Assembly", None)
|
|
||||||
aggregate_collection.objects.link(aggregate)
|
|
||||||
bpy.ops.bim.assign_class(obj=aggregate.name, ifc_class="IfcElementAssembly")
|
|
||||||
|
|
||||||
tool.Collector.sync(obj)
|
tool.Collector.sync(obj)
|
||||||
current_aggregate = ifcopenshell.util.element.get_aggregate(element)
|
current_aggregate = ifcopenshell.util.element.get_aggregate(element)
|
||||||
current_container = ifcopenshell.util.element.get_container(element)
|
current_container = ifcopenshell.util.element.get_container(element)
|
||||||
@@ -126,3 +121,11 @@ class AddAggregate(bpy.types.Operator):
|
|||||||
)
|
)
|
||||||
core.assign_object(tool.Ifc, tool.Aggregate, tool.Collector, relating_obj=aggregate, related_obj=obj)
|
core.assign_object(tool.Ifc, tool.Aggregate, tool.Collector, relating_obj=aggregate, related_obj=obj)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
def create_aggregate(self, context):
|
||||||
|
aggregate_collection = bpy.data.collections.new("IfcElementAssembly/Assembly")
|
||||||
|
context.scene.collection.children.link(aggregate_collection)
|
||||||
|
aggregate = bpy.data.objects.new("Assembly", None)
|
||||||
|
aggregate_collection.objects.link(aggregate)
|
||||||
|
bpy.ops.bim.assign_class(obj=aggregate.name, ifc_class="IfcElementAssembly")
|
||||||
|
return aggregate
|
||||||
|
|||||||
Reference in New Issue
Block a user