Objects in Blender are linked to Scenes. There may be more than one scene in Blender at any given moment. The following code snippet demonstrates how to remove the cube that is in the default scene in Blender using Pyhton.
- Open Blender
- Split the windows to see an outline view, a script view, and a 3-D view. This will help see what happens when the object is deleted.
- Manually enter the python script. When the last line is entered, the views will be updated and the default cube will disappear.
import Blender from Blender import Scene # get a list of all scenes in Blender scns = Scene.Get() # get the first scene in the list scn = scns # get the first object in the scene, # this should be the cube obs = list(scn.objects) # unlink the object from the scene scn.unlink(obs) # update all of the views in the user inteface Window.RedrawAll()