CREATING CUBES using python script


I am trying to do two things within Blender at this moment using a python script:

  1. Create “solid” cubes NOT just meshes of different sizes
  2. Perform Boolean operations on these boxes if they intersect.

I do realize that this can be done by selection, but what method do you advise using a script?




you might look at the boolean script for intersections.

just search the forum.

What do you mean by solid? Do you mean have them drawn solid (ie the faces are filled instead of wireframe)? That is set in the Object module.

for the object creation do something like

import Blender
from Blender import *

myScene = Scene.GetCurrent()
myObject = Blender.Object.New(‘NMesh’) #or Mesh can’t recall which

You’ll have to specify your cube by creating a list of faces and a list of vertices. (easiest way would be just do Object.GetSelected()[0].getData() on a cube and copy that…).

Look at the Scene, Object, NMesh, NMFace, NMVert and related modules.



I actually figure out what I wanted to do:


I actually needed solid geometry not just faces, but I will snoop around for the boolean functions.




Does anyone know how to select objects using Python scripting?

I am trying to select two objects from my scene and performing the Boolean function subtract on both. This I want to do using Python.


Select Object A
Select Object B

Perform Boolean subtract

Any information will help


I am no expert, there are alot of those around here … but I do know that there is no such thing as a solid anything. If you create a cube mesh … slice it in half using a plane with booleans … faces are added automatically to give it the appearance of being a solid. This is what you have to work with in the 3D world. I know of no 3D application that would do it in any other way.

If I have misunderstood you, then my appologies.

i think realsoft3d is able to manage really SOLID-OBJECTS not just skinned.

Well, personally, I don’t know why it would matter. Just look at any of the galleries and/or animations that have been done with Blender to see it’s potential. If you’re still not satisfied, then I suggest you purchase realsoft3D. It won’t be free … it’ll be quite expensive … but you’ll get what you want.

I think I may have been misunderstood. I am getting the appearance of a solid cube which is what I wanted, but on the other hand, I needed to know how to script:

Select Object A
Select Object B

Then run a Boolean opeartion on both

Any info will help.


Import Blender
from Blender Import Scene, Object

myObjectList = Blender.Object.Get() #gets a list of all objects in the scene

now use standard python to go through the list and get whichever ones you want.

See the object module for how to get the object names, etc.


Thanks! I guess I have been unclear as I am not very good with words.

The most important part is having both of my objects which I grab from the list/array of objects…

now I needed to know of a possible script for performing a Boolean function preferably difference/subtract on both objects:

objs = get objects
Boolean.Subtract(objs[1], objs[2])

Something like the above I am trying to perform. I guess I am trying to understand how to get to the internal Boolean functions using a call method or script.

THanks for all your input, it helps!


So, like was mentioned before, there’s no python function to do boolean operations on meshes. But, there’s my boolean system, which works better overall than the current built in system (except in certain weird cases that I’m working on), and happens to be a python script. There’s a post about it in this forum. At the end of the script is an example to do exactly what you want:

#print oA
#print oB

If you cange that bit to:


It will get an object named “Cookie”, and do a difference operation, subtracting the object named “Cutter”.


I will try this right now and keep you posted or may ask questions if they arise.