select inside or rasterize script?

hi,
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,
Anderl

the problem is solved, someone at blendpolis.de send me the link to a script that rasterizes the model: http://wiki.blender.org/index.php/Extensions:2.4/Py/Scripts/Add/Cells_v1.2

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"):
        return
    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):
        return
    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
    return
    

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…

Regards,