Cannot get the for loop to run only insight of array

I'm trying to get a loop to run through the faces I've selected but it runs true all the faces of the model.. what am i doing wrong.

try (closeRolloutFloater MainFloater) catch()
 
fn Makeplaner ev nodes =
(	
    for n in nodes where isKindOf (obj = getAnimByHandle n) Editable_Poly do (
			if planer ==true then
			(	
                obj.EditablePoly.ConvertSelection #Vertex #Face
				Mplaner = obj.GetSelection #Face
				For i = 1 to Mplaner.count do
				(
                obj.EditablePoly.SetSelection #Face #{i}
				obj.EditablePoly.makePlanar #Face 
				)
				Mplaner = undefined
				Polymodel = undefined
				gc light:true
				rerun() --call fn rerun
			)
    )
)
Fn rerun =
(
	if planer == true then
	(	
			Polymodel = NodeEventCallback mouseUp:true delay:5000 geometryChanged:Makeplaner
!REG3XP1!>
	)
)
 
		
Rollout Menu01 "PPLANER" 
(
	checkbutton two "Check" pos:[2,6] width:80 height:20
	on two changed state do 
		(
		if state ==true then
		(	
			global planer = true
			rerun() 
		)
		else
		(
			global planer = false
		)
		)
 
)
MainFloater = NewRolloutFloater "" 178 55
addRollout Menu01 MainFloater

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Harvid's picture

I have pretty much got it to

I have pretty much got it to work.
but it only on my desktop computer on my laptop it not running the Fn rerun.. some ideas why ?

fn Makeplaner ev nodes =
(	
    for n in nodes where isKindOf (obj = getAnimByHandle n) Editable_Poly do (
			if planer ==true then
			(	
                                obj.EditablePoly.ConvertSelection #Vertex #Face
				Mplaner = obj.GetSelection #Face as array
				for i in Mplaner do
				(
					subobjectLevel = 4
                                $.EditablePoly.SetSelection #Face #{i}
				$.EditablePoly.makePlanar #Face 
 
				)
				subobjectLevel = 1
				Polymodel = undefined
				gc light:true
 
			)
    )
)
 
Fn rerun =
(
	if planer == true then
	(	
			Polymodel = NodeEventCallback mouseUp:true delay:5000 geometryChanged:Makeplaner
 
	)
)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.