diff --git a/src/blenderbim/blenderbim/bim/module/model/__init__.py b/src/blenderbim/blenderbim/bim/module/model/__init__.py index 2528a547bd..48cf759114 100644 --- a/src/blenderbim/blenderbim/bim/module/model/__init__.py +++ b/src/blenderbim/blenderbim/bim/module/model/__init__.py @@ -47,6 +47,9 @@ classes = ( array.EnableEditingArray, array.RemoveArray, array.SelectArrayParent, + array.Input3DCursorXArray, + array.Input3DCursorYArray, + array.Input3DCursorZArray, product.AddConstrTypeInstance, product.AddEmptyType, product.AlignProduct, diff --git a/src/blenderbim/blenderbim/bim/module/model/array.py b/src/blenderbim/blenderbim/bim/module/model/array.py index f464387049..bc4079f4cc 100644 --- a/src/blenderbim/blenderbim/bim/module/model/array.py +++ b/src/blenderbim/blenderbim/bim/module/model/array.py @@ -175,3 +175,42 @@ class SelectArrayParent(bpy.types.Operator): context.view_layer.objects.active = obj obj.select_set(True) return {"FINISHED"} + +class Input3DCursorXArray(bpy.types.Operator): + bl_idname = "bim.input_cursor_x_array" + bl_label = "Get 3d Cursor X Input for Array" + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + obj = context.active_object + #element = tool.Ifc.get_entity(obj) + props = obj.BIMArrayProperties + cursor_location = context.scene.cursor.location + props.x = cursor_location.x - obj.location.x + return {"FINISHED"} + +class Input3DCursorYArray(bpy.types.Operator): + bl_idname = "bim.input_cursor_y_array" + bl_label = "Get 3d Cursor Y Input for Array" + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + obj = context.active_object + #element = tool.Ifc.get_entity(obj) + props = obj.BIMArrayProperties + cursor_location = context.scene.cursor.location + props.y = cursor_location.y - obj.location.y + return {"FINISHED"} + +class Input3DCursorZArray(bpy.types.Operator): + bl_idname = "bim.input_cursor_z_array" + bl_label = "Get 3d Cursor Z Input for Array" + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + obj = context.active_object + #element = tool.Ifc.get_entity(obj) + props = obj.BIMArrayProperties + cursor_location = context.scene.cursor.location + props.z = cursor_location.z - obj.location.z + return {"FINISHED"} diff --git a/src/blenderbim/blenderbim/bim/module/model/ui.py b/src/blenderbim/blenderbim/bim/module/model/ui.py index 10bf9e181f..f5d1bb47aa 100644 --- a/src/blenderbim/blenderbim/bim/module/model/ui.py +++ b/src/blenderbim/blenderbim/bim/module/model/ui.py @@ -227,10 +227,17 @@ class BIM_PT_array(bpy.types.Panel): row.prop(props, "dimension_input_type") row = box.row(align=True) row.prop(props, "use_local_space") - row = box.row(align=True) + #row = box.row(align=True) + col = box.column() + row = col.row(align=True) row.prop(props, "x") + row.operator("bim.input_cursor_x_array", icon="CURSOR", text="") + row = col.row(align=True) row.prop(props, "y") + row.operator("bim.input_cursor_y_array", icon="CURSOR", text="") + row = col.row(align=True) row.prop(props, "z") + row.operator("bim.input_cursor_z_array", icon="CURSOR", text="") else: row = box.row(align=True)