Here I have a code, and it works, but it still needs some corrections! Let's say, you have a group of glasses and you want to add it to all the tables that are groups and copied as instances! I have placed my glasses on one of the tables, then pressed btn and picked the table bellow=> this should automatically add it to all tables! The problem is with transform: If you rotated some tables, then the glasses may stay outside allready! Scale, I guess should not be affected by the scale of tables, otherwise, added glasses can get unreal dimesions! There are some errors also, when you have an object selected from an opened group, but I know how to fix- tu detach selection first, in this case! Please, who wants and are interested, you're wellcome to comment!
fn filterSelect obj = ( if isOpenGroupMember obj then return obj --and isValidNode obj if isGroupMember obj then ( while (obj.parent != undefined) and (not isOpenGroupHead obj.parent ) and (isGroupHead obj.parent) do obj = obj.parent return obj ) return obj ) rollout ... on instatachbtn click do ( local objList = #() local selObjList = #() local target = pickObject() target = filterSelect target append selObjList target j=1 while j<= objects.count and not keyboard.escPressed do ( if areNodesInstances target objects[j] then ( appendIfUnique selObjList objects[j] --print objects[j] ) j=j+1 ) -- print "============" -- print selObjList -- print "================Selection" for i in selection do appendIfUnique objList (filterSelect i) -- print objList local delta, deltap, deltar, deltas for i in objList do ( if isOpenGroupMember i then detachNodesFromGroup i delta = i.transform - target.transform deltap = i.position - target.position deltar = i.rotation-target.rotation deltas = i.scale - target.scale for j in selObjList do ( maxOps.cloneNodes i cloneType:#instance newNodes:&newGroup tempObj= newGroup tempObj.transform = j.transform+delta --tempObj.scale = j.scale+deltas -- tempObj.rotation = j.rotation + deltar -- tempObj.position = j.position+deltap attachNodesToGroup tempObj j ) delete i ) )