Maxscript [i] list


#1

Hi everyone ! :grin:
I hope you are fine.
Can you guyz help me please with a small script i’m trying to do ?

for i in 1 to selection.count do
(
max modify mode-- open mod panel
addModifier $[i] (Unwrap_UVW ()) ui:on
subobjectLevel = 3
max select all --// just want to select all the polygons// –
$[i].modifiers[#Unwrap_UVW].mappingMode 1 --// planar mode// –
$[i].modifiers[#Unwrap_UVW].mappingReset() --// reset for clean// –
$[i].modifiers[#Unwrap_UVW].mappingAlign 1 --// align in Y axis// –
$[i].modifiers[#Unwrap_UVW].FlattenBySmoothingGroup true true 0.02
macros.run “Modifier Stack” “Convert_to_Poly” --// COLLAPS ALL// –
$.pivot = [0,0,0] --// pivot to 0.0.0// –
)

Here I want to select objects and apply to them some modifiers and reset the pivot to 0.
Unfortunatly it doesn’t really work.
thanks


#2

here is my version (without any fancy stuff):

(
	max modify mode
	nodes = for node in selection as array where iskindof node GeometryClass collect node
	for node in nodes do
	(
		modi = Unwrap_UVW()
		applymodifier node modi
		modpanel.setcurrentobject modi
		modi.setTVSubObjectMode 3
		modi.SelectFaces #{1..modi.numberPolygons()}
		
		modi.mappingMode 1
		modi.mappingReset()
		modi.mappingAlign 1
		modi.FlattenBySmoothingGroup true true 0.02
		
		node.pivot = [0,0,0]
		converttopoly node 
	)
	nodes
)