Notifications
Clear all

[Closed] Script that applies Clear All for Smoothgroups

Hello,

I am in the process of cleaning up some objects that have been giving to me. They are all Editable Meshes and I have been selecting each meshes Polygon sub level and then clearing the smooth groups pressing the Clear All. However a script would be so much easier. I did find the following on this forum:

polyOp.setFaceSmoothGroup selection[1] #all 1

But this only applies the SmoothGroup 1 and I want to use the Clear All as indicated above and have it work for an Editable Mesh.

Does anyone know what needs to be put into this script to allow this?

Regards

8 Replies

Well, I was to lasy to make an edit mesh version and to read the doc, soo I made a script that will take all you obj in you selection and convert them in edit poly iif they are edit mesh and do the smoothing groupe job. When the process will be finished, it wil reconvert to editmesh soo this thing should to the job.

rollout BatchSmooth0Rollout "BatchSmooth0"
   (
   	button btnSmooth0forall "Clear all SmoothingGr" 
   	on btnSmooth0forall pressed  do
   	(
   		
   		Myobjselection = #()
   		max create mode
   		
   		if selection.count > 0 then 
   		(
   			for obj in $ do
   			(
   				append Myobjselection obj
   			)
   		)
   		else if selection.count == 0 then
   		(
   			actionMan.executeAction 0 "40021"  -- Selection: Select All
   			for obj in $ do
   			(
   				append Myobjselection obj
   			)
   		)
   
   		for i in $ do
   		(
   			if classof i == Editable_mesh then
   			(
   				macros.run "Modifier Stack" "Convert_to_Poly"
   			)
   		)
   		for obj in Myobjselection do
   		(
   			select obj
   			if classof obj == Editable_Poly then
   			(
   				for i = 1 to $.faces.count do
   				(
   					polyOp.setFaceSmoothGroup $ i 0 -- Your smoothing that you want is here.
   				)
   				macros.run "Modifier Stack" "Convert_to_Mesh"
   			)
   		)
   		for obj in Myobjselection do
   		(
   			selectmore obj
   		)
   	)
   )
   createdialog BatchSmooth0Rollout

–Edit: By the way, it will only work if you have an editpoly or edit mesh selected else way, it will work if nothing is selected. If you have problem with it just ask,Should work on all version of max. Tested on 7 and 8.

Hi
You can also use

polyOp.setFaceSmoothGroup selection[1] #all 0

Cool, thx for this line.

Thank you for the script. It doesn’t matter if it stays an Editible Poly now that I think about it. Would I just take some of the lines out of your script that tell it to re-convert to a Mesh?

I got it to work by just removing

macros.run “Modifier Stack” “Convert_to_Mesh”

Works great!

Thanks!!

Yup, but if it doesn’t matter, you can also keep the line :P.
I’m glad to have been able to help, I also have a complete smoothing groups tool, That I’m actually working on, cause I hate to make smoothing groups job with the 3dsmax tool. I don’t know if the community will be interested in it, and I’m working on it in my free time, to learn maxscript. I will correct some bugs in my script and post it soon and see if there is others peoples than me and peoples at work, that will be interested in it.

There is a “smooth” modifier, just put this on your selected objects and it will remove smothing groups automatically

Yeah, but if you have some faces selected in object, it will do it only on obj selected faces for each object in your selection. Soo, he will need to pass each obj and deselect faces to apply the modifier. Or just repass each obj one by one.