Created
January 31, 2023 06:16
-
-
Save CGArtPython/f758b625521d39ce950cbfc7f5a0d451 to your computer and use it in GitHub Desktop.
Add a cube into the scene and update the hight
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
custom_size = 5 | |
# add cube into the scene | |
bpy.ops.mesh.primitive_cube_add(size=custom_size) | |
cube_obj = bpy.context.active_object | |
# move the cube up half way on the Z axis | |
cube_obj.location.z = custom_size / 2 | |
# set the origin of the cube to the cursor location | |
bpy.ops.object.origin_set(type="ORIGIN_CURSOR", center="MEDIAN") | |
# scale the cube on the Z axis | |
bpy.context.active_object.scale.z *= 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment