Notifications
Clear all

[Closed] autosmooth

Working on a new script. I want to make a button that selects all models in the scene and applies an autosmooth modifier to all the objects. I tried on my own first and after that used the help to guide me, but alas, combined will cause errors. dont pay attention to the n00bness coding.

My code. (which works to a certain extent. The script does everything except apply a autosmooth modifier.)

 
	on smth_groups_all pressed do -- not working yet
	(
		actionMan.executeAction 0 "40021"  -- Selection: Select All 
			for o in selection do (
			modPanel.addModToSelection (Edit_Poly ()) ui:on
			converttopoly o
			subobjectLevel = 4
			actionMan.executeAction 0 "40021"  -- Selection: Select All
			o.EditablePoly.autosmooth ()
				)
			actionMan.executeAction 0 "40021"  -- Selection: Select All
		for o in selection do (	
			collapseStack o 
			converttopoly o
			)
			clearSelection()	
	
	)

Then with some help from the HELP files I edited the script and came to the following:

 	on smth_groups_all pressed do -- not working yet
	(
		actionMan.executeAction 0 "40021"  -- Selection: Select All
			for o in selection do (
			modPanel.addModToSelection (Edit_Poly ()) ui:on
			converttopoly o
			subobjectLevel = 4
			actionMan.executeAction 0 "40021"  -- Selection: Select All
				for p in selection do (
				actionMan.executeAction 0 "40021"  -- Selection: Select All
				p.ButtonOp #Autosmooth
				)
			)
		for o in selection do (	
			collapseStack o 
			converttopoly o
			)
			clearSelection()	
	
	)

Yet somehow it still doesnt select all the faces. anyone an idea?

t.i.a.

3 Replies

try this:

max create mode
angle = 30
sm = SmoothModifier autoSmooth:true threshold:angle
for o in geometry do addModifier o sm
1 Reply
(@papigiulio)
Joined: 1 year ago

Posts: 0

Dang!! It works perfect. I didnt even know max had a seperate smooth modifier, I always use the smoothingstuff in the EditablePoly modifier. Shouldve searched for ‘smooth’ in the helpfiles I guess.

Thanks Gravey

 PEN

Time to dig through all those modifiers in the list that you have never used and find out what they are for.