# Is it possible to create a shortcut button for a cube and sphere with custom dimensions? [duplicate]

For example:

I want to be able to just click a button and able to have the same size cube or sphere every time. I'm gonna be making hundreds of cubes and spheres all the same size but I don't want to keep having re-size them every time I create them.

I want the spheres to always be 10m and the Cubes to be 15 x15x20mm Is this possible?

Thank so you for time in advance weather you can help or not

import bpy

class HelloWorldPanel(bpy.types.Panel):
"""Creates a Panel in the Object properties window"""
bl_label = "WIRES  &  PIPES"
bl_idname = "OBJECT_PT_hello"
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
#bl_category = "Shortcuts"

def draw(self, context):
layout = self.layout

row = layout.row()
op.size = 0.5
op.scale = (1, 2, 3)

def register():
bpy.utils.register_class(HelloWorldPanel)

def unregister():
bpy.utils.unregister_class(HelloWorldPanel)

if __name__ == "__main__":
register()

• can you tell us a bit more why you need hundreds of cubes? do you move them all by hand? or why do you need that much? Jul 13 at 16:50
• just e.g. you could just use CTRL-D to duplicate an object - which is IMHO faster than tapping a button.... Jul 14 at 0:22

Add the operator properties to the layout.

Add a primitive using the UI, and take note of the chosen parameters. Can then add to draw method of TOOL panel

    def draw(self, context):
layout = self.layout

col = layout.column()
op.scale = (1, 2, 3)
op.size = 1


will add an add cube operator button than when pressed adds a dimension (0.5, 1.0, 1.5) blender unit cube to the scene.

Related:

To see any errors or warnings: Where does console output go

• Hello BatFINGER..... Where can I add the custom size here? I think I am doing something wrong, I'm super new at this row = layout.row() row.operator("mesh.primitive_cube_add", text="Plug", icon="MESH_CUBE") row.operator("mesh.primitive_uv_sphere_add", text="Ground", icon="MESH_UVSPHERE") Jul 14 at 20:17
• As in answer. op = row.operator(...) then op.size = 0.2 Jul 14 at 20:28
• I'm still screwing it up somehow :( Jul 15 at 1:53
• Edit your draw method into question. Jul 15 at 3:20
• batFINGER, I tired the script that you helped me with, but my cubes still didn't change dimension. I feel really stupid doing this lol especially since I never written anything before. I looked at the other suggestions but they just confused me even more :P Jul 15 at 16:00