Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· openaiHugging Face Suzhen/CodeChat

please write a blender script for me which deletes the cube

  1. User

    please write a blender script for me which deletes the cube

  2. Assistant

    Sure, here is a simple Blender script that deletes the default cube object in the scene:

    import bpy
    
    # Select the cube object
    bpy.data.objects["Cube"].select_set(True)
    
    # Delete the selected object(s)
    bpy.ops.object.delete()
    

    To run this script in Blender, follow these steps:

    1. Open Blender and open a new or existing project.
    2. Switch to the "Scripting" workspace by selecting it from the top bar.
    3. In the Text Editor panel, click on the "New" button to create a new text file.
    4. Copy and paste the above script into the text file.
    5. Press the "Run Script" button or use the shortcut Alt+P to execute the script.
    6. The default cube should now be deleted from the scene.

    Make sure to save your Blender project before running the script to avoid any unintended consequences.