Skip to content

Instantly share code, notes, and snippets.

@demohero101
Created November 13, 2023 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save demohero101/7c513c22fe2fb7653600f53e5d1361ef to your computer and use it in GitHub Desktop.
Save demohero101/7c513c22fe2fb7653600f53e5d1361ef to your computer and use it in GitHub Desktop.
ChatGPT Code 1
import bpy
# Clear existing mesh objects in the scene
bpy.ops.object.select_all(action='DESELECT')
bpy.ops.object.select_by_type(type='MESH')
bpy.ops.object.delete()
# Add a cube
bpy.ops.mesh.primitive_cube_add(size=2, location=(0, 0, 0))
# Add a sphere
bpy.ops.mesh.primitive_uv_sphere_add(radius=1, location=(3, 0, 0))
# Add a torus
bpy.ops.mesh.primitive_torus_add(location=(6, 0, 0), align='WORLD', major_radius=1, minor_radius=0.3)
# Update the scene
bpy.context.view_layer.update()
# Print a message
print("Cube, sphere, and torus added to the scene.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment