I am aware that I have already asked this question before I apologize ahead of time.
BUT I am STILL struggling really bad with it. as simple as it looks for some of you its really hard for me. The other similar answers suggested to me didn't help since I am super new at scripting.
here is some information----
I am using Blender 2.79b
I'm writing a code that I will eventually turn into addon at the end. the code is supposed to have 3 shortcut buttons.
button1- to add a cube
button2- to add a sphere
button3- to add a cylinder
Once each button is pressed, I want the object to have a custom scale or dimension. For example: Once the Add Cube button is pressed, Cube gets created with these dimension (15, 20, 15)
If you can help please be specifi since I have NOOOO idea what I am doing :p
Here is my code
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 = "NEW"
def draw(self, context):
object = context.object
layout = self.layout
row = layout.row()
row.operator("mesh.primitive_cube_add")
bpy.ops.transform.resize(value=(7.5, 10, 7.5))
row = layout.row()
row.operator("mesh.primitive_uv_sphere_add")
bpy.ops.transform.resize(value=(5, 5, 5))
row = layout.row()
row.operator("mesh.primitive_cylinder_add")
bpy.ops.transform.resize(value=(12, 12, 5))
def register():
bpy.utils.register_class(HelloWorldPanel)
def unregister():
bpy.utils.unregister_class(HelloWorldPanel)
if __name__ == "__main__":
register()