ScriptSpot is a diverse online community of artists and developers who come together to find and share scripts that empower their creativity with 3ds Max. Our users come from all parts of the world and work in everything from visual effects to gaming, architecture, students or hobbyists.
this script will attach all objects that share the same name if they can be converted to poly. if you need it to work only on selected objects just replace "objects" by "selection" in line : " local objs = for o in objects where canConvertTo o Editable_Poly collect o"
(
fn clusterAttach objArr =
(
j = 1
while objArr.count > 1 do(if isvalidnode objArr[j] and classof objArr[j]!= Editable_Poly do converttopoly objArr[j]
polyop.attach objArr[j] objArr[j+1]
deleteItem objArr (j+1)
j += 1
if(j + 1)> objArr.count do j = 1
)
centerpivot objArr[1]
return objArr[1])
fn Arraybyname Arr currentName =
(
local outArr = #()for o in arr where isvalidnode o and o.name == currentName do append outArr o
return outArr
)
fn getUniqueNames objArr =
(
local nameSet = #()for o in objArr where isvalidnode o do(
appendIfUnique nameSet o.name
)
return nameSet
)
undo "Attach by name" on
(
max create mode
with redraw off
(
local objs = for o in objects where canConvertTo o Editable_Poly collect o
local uniqueNames = getUniqueNames objs
for name in uniqueNames do(
tmpArr = Arraybyname objs name
if tmpArr.count > 1 do(
clusterAttach tmpArr
)))
redrawViews()))
Comments
Hi,
this script will attach all objects that share the same name if they can be converted to poly. if you need it to work only on selected objects just replace "objects" by "selection" in line : " local objs = for o in objects where canConvertTo o Editable_Poly collect o"