From 677324927c23706ada371d34df1dcba71903f9cc Mon Sep 17 00:00:00 2001 From: Ryan Schultz Date: Fri, 26 Apr 2024 20:09:20 -0500 Subject: [PATCH] fix #4431: prompt for name, when creating aggregate --- .../blenderbim/bim/module/aggregate/operator.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/aggregate/operator.py b/src/blenderbim/blenderbim/bim/module/aggregate/operator.py index 7c9b2d5fd1..2c3fbef38e 100644 --- a/src/blenderbim/blenderbim/bim/module/aggregate/operator.py +++ b/src/blenderbim/blenderbim/bim/module/aggregate/operator.py @@ -132,6 +132,7 @@ class BIM_OT_add_aggregate(bpy.types.Operator, tool.Ifc.Operator): bl_options = {"REGISTER", "UNDO"} obj: bpy.props.StringProperty() ifc_class: bpy.props.StringProperty(name="IFC Class", default="IfcElementAssembly") + aggregate_name: bpy.props.StringProperty(name="Name", default="Default_Name") def invoke(self, context, event): return context.window_manager.invoke_props_dialog(self) @@ -139,13 +140,15 @@ class BIM_OT_add_aggregate(bpy.types.Operator, tool.Ifc.Operator): def draw(self, context): row = self.layout row.prop(self, "ifc_class") + row = self.layout + row.prop(self, "aggregate_name") def _execute(self, context): try: ifc_class = tool.Ifc.schema().declaration_by_name(self.ifc_class).name() except: return - aggregate = self.create_aggregate(context, ifc_class) + aggregate = self.create_aggregate(context, ifc_class, self.aggregate_name) for obj in context.selected_objects: element = tool.Ifc.get_entity(obj) @@ -173,8 +176,8 @@ class BIM_OT_add_aggregate(bpy.types.Operator, tool.Ifc.Operator): ) core.assign_object(tool.Ifc, tool.Aggregate, tool.Collector, relating_obj=aggregate, related_obj=obj) - def create_aggregate(self, context, ifc_class): - aggregate = bpy.data.objects.new("Assembly", None) + def create_aggregate(self, context, ifc_class, aggregate_name): + aggregate = bpy.data.objects.new(aggregate_name, None) aggregate.location = context.scene.cursor.location bpy.ops.bim.assign_class(obj=aggregate.name, ifc_class=ifc_class) return aggregate