select inside or rasterize script?

i need either a script that selects all objects their centers are inside the selected object, or a script that rasterizes a selected mesh (recreates the mesh with cubes only, should look a bit like lego…)
it would be great if you can help me :slight_smile:
knd regards,

the problem is solved, someone at send me the link to a script that rasterizes the model:

In 2.49b, the following code selects ALL objects which center (object location point) is inside the selected object:

def Obj_centers_inside():
    sce = Scene.GetCurrent()
    ob = Object.GetSelected()[0]
    if (ob.type<>"Mesh"):
    me = ob.getData(mesh=1)
    V = len(me.verts)
    E = len(me.edges)
    F = len(me.faces)
    Euler_constant = V-E+F
    if (Euler_constant<>2):
    mat = ob.mat
    mat_inv = Mathutils.Matrix(mat).invert()
    sce.objects.selected = []
    for ob in sce.objects:
        if (ob.type=="Mesh"):
            C = Mathutils.Vector(ob.loc)
            if me.pointInside(C*mat_inv):
              ob.sel = 1

For an object to contain centers of other (mesh) objects is used ONLY (by intention) a mesh object that is a mathematically closed body with NO duplicated faces, orphan edges or such.

This question should have been asked in Python section of this forum, I think…