Announcement

Collapse
No announcement yet.

Script to copy align rotate and replace 1 object to multiple others

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Script to copy align rotate and replace 1 object to multiple others

    Hi all

    Max's "replace" is very limited. I have couple of thousand instanced objects in my scene which I want to replace by a newer version. How do I go about doing that?

    EDIT: Hmmm found objectReplacer in the Soulburn Script Pack - will give that a go and see.
    Last edited by Morne; 06-09-2011, 12:05 AM.
    Kind Regards,
    Morne

  • #2
    if you replace thousand objects via maxscript it could thake some time cause
    maxscript is not multithreading.
    Here is a small script to replace objects:

    -----------------------------------------------------------------------------------------

    macroScript gantmxs_replace category:"gantmxs" buttontext:"Replace Selection..."
    (
    on isEnabled return (selection.count != 0)
    on Execute do
    (
    sel_arr = (for s in selection where s.parent == undefined collect s)
    fn filter_geometry obj = obj.parent == undefined
    global replobj = pickobject count:1 filter:filter_geometry
    if replobj != undefined then
    (
    for i = 1 to sel_arr.count do
    (
    replobj.transform = sel_arr[i].transform
    maxops.clonenodes (getobjchildren replobj) newNodes:&item cloneType:#instance
    )
    for i = 1 to sel_arr.count do
    (
    delete (getobjchildren sel_arr[i])
    )
    )
    )
    )
    if menuMan.registerMenuContext 0xf5e3905 then
    (
    (menuMan.findMenu "&Tools").addItem (menuMan.createActionItem "gantmxs_replace" "gantmxs") 19
    menuMan.updateMenuBar()
    )
    -----------------------------------------------------------------------------------------

    much faster would it be to place Vrayproxys and only change the vrayproxy-meshfile.

    Comment


    • #3
      soulburn object replacer work instantly for me. In my case I wanted to replace standard instanced meshes with a newer vrayproxie version
      Kind Regards,
      Morne

      Comment

      Working...