[IButton,???,"Copy subtool and assign materials to polygroups", [IConfig,2021] [VarSet,maxMats,[IGetMax,Material:Item Info]] [If,[IExists,Tool:Geometry:Del lower],,[Exit]]//must be a polymesh [IPress,Tool:Clone] [ISet,Tool:Item Info,[IGetMax,Tool:Item Info]] [IKeyPress,'2',[IPress, Tool:SubTool:Groups Split]] [ISet,Material:Item Info,1] [VarSet,matId,1] [VarSet,loopNo,[SubToolGetCount]] [ISet,Draw:Mrgb,0] [ISet,Draw:RGB,0] [ISet,Draw:M,1] [Loop,loopNo, [SubToolSelect,[Val,n]] [ISet,Material:Item Info,[Var,matId]] [IPress,Color:Fill Object] [VarInc,matId] [If,(matId > maxMats),[VarSet,matId,1]] ,n] [SubToolSelect,0] [Loop,[SubToolGetCount]-1, [IKeyPress,'2',[IPress, Tool:SubTool:Merge Down]] ] ]/*End of Macro*/