working with (array) modifier in 2.49

I am working on a script to replace objects.

For architectural visualisation I have files where I have lots of duplicates of one object and want to replace them with duplicates of another objects.

I have managed to tackle parenting and local/global coordinates.

As I am using the array modifier sometimes I would also like to check for that in the search object and create that in the replace duplicate.

I am stuck finding the right settings. I am using the zoologique api site for lookup but I cannot seem to find what I need.

Anyone able to point me in the right direction?
Also am open to improvement ideas of the current script.

thanks in advance

script looks like this so far:

import bpy
import Blender
#from Blender import *

print "START--------------------"

sce =

#list of search/replace tuples
searchReplaceObj = [
    ("Cube", "Sphere"), 
    ("Cylinder", "Pyramid")]

for cur_SRO in searchReplaceObj:
    searchObj = cur_SRO[0]
    replaceObj = cur_SRO[1]
    print "searching for [%s]" % searchObj
    print "replacing with [%s]" % replaceObj

    sce.objects.selected = []

    for obj in sce.objects:
        if obj.getName()[:len(searchObj)] == searchObj:
            print obj, obj.getName(), obj.getParent()
            mods = obj.modifiers
            for mod in mods:
                print mod,
            # get replacement Object
            obj_new = Blender.Object.Get(replaceObj)
            # make it active
            obj_new.sel = 1
            # duplicate it
            # get the current duplicated
            ob_act =
            # get worldspace data
            (x, y, z) = obj.getLocation('worldspace')
            (rx, ry, rz) = obj.getEuler('worldspace')
            # print loc, rot
            # update the location
            ob_act.LocX = x
            ob_act.LocY = y
            ob_act.LocZ = z
            # update the rotation
            ob_act.RotX = rx
            ob_act.RotY = ry
            ob_act.RotZ = rz
            # possibly update parent
            if obj.getParent():
                ob_list = []
            # deselect all
            sce.objects.selected = []
            # delete original search object


Misread this…

i guessed Modifier.Settings.COUNT and Modifier.Settings.OFFSET_VEC but I am missing the Setting name for defining that I want to use CONSTANT and not RELATIVE OFFSET. so far when I create a new array modifier it is set to relative offset by default.

from the api docu list i cannot guess which setting controls this.

so tips anyone? :slight_smile:

Thats the problem with the array modifer, and other modifiers in 2.49. Not all the properties were actually coded into the API. So you may go down a developement path and find that you are stuck. You can try and guess, like with count, but my advice is to simply move up to 2.5 where you can use the data browser to find all the parameters of any property.

i am using this in production environment. is 2.5 stable enough to make a change? i dont want to switch unless i am able to depend on it.

I guess I found my answer here :slight_smile: