ScriptSpot

Forum topic · General Scripting

[3DSMAX] Instance replace script that also replaces groups

By OccultArt · 2015-02-28

Description

Does anyone know where to find an instance replace script that also replaces groups? Most replace script that I know will only replace objects but not whole groups.

- Replace multiple Objects by a Group (instanced)
- Replace multiple Groups by a Group (instanced)
- Replace multiple Groups by an object (instanced)

Comments (2)

Base code (not tested)

TsveTan · 2015-03-11

oGroupByName = "groupToBeCloned"
oCGroupName = "MyGroup"

oGroup = getNodeByNane (oGroupByName)
setGroupOpen oGroup true
groupHeaad = undefined
oGroupMembers = #()

groupMembers = #()
for o in $objects do (
if isOpenGroupMember o do (
insertitem o groupMembers (groupMembers.count + 1)
)
if isGroupHead o do (groupHead = o /*maybe do something else*/)
)

clonedGroupMembers = #()
for o in groupMembers do (
i = instance o
insertItem i clonedGroupMembers (clonedGroupMembers.count + 1)
)

-- creating the instancied members' group
group clonedGroupMembers name:oCGroupName
setGroupOpen oGroup false

/*You can create a rollout with two edittexboxes for the target and dest. groups and a button , that creates the group.
Unused groups should be closed.*/

OccultArt · 2015-03-09

Is there no instance replace script that also replaces groups and can replace objects or groups with instances of a certain groups? Does anyone have some code, that shows how to replace groups by an instance of an other group?