Notifications
Clear all

[Closed] Set smoothing groups 0

I need a script that I can run to set smoothing groups to 0. This is what I have right now and its just not working.

(
(if (selection.count > 0) then – Start of if
for i in selection do (
(
resetXform i; –Reset Xfrom cammand.
modPanel.setCurrentObject
i.modifiers[#XForm]
maxOps.CollapseNode i off
subobjectLevel = 0
convertTo i PolyMeshObject
– i.EditablePoly
– i.EditablePoly.SetSelection #Vertex#{1…2346}
– i.weldThreshold = 0.001
– i.buttonOp #weldSelected
addmodifier i (vertex_weld threshold:0.001)
maxOps.CollapseNode i off
i.EditablePoly.setSmoothingGroups 0
)
)
else
(
messagebox “To reset Xform please select an object!”
) – end of if
)
)

here is the error.

– Error occurred in i loop
– Frame:
– i: $rodon_vill_ext_wallpannels_caps_03_02
– called in anonymous codeblock
– Frame:
– Argument count error: setSmoothingGroups wanted 3, got 1

Help would be great!!!

also on another note, is there away to set import defaults with maxscript?

thanks!

4 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

for n in selection as array where iskindof n Editable_Poly do
(
	n.selectedfaces = #{1..n.numfaces}
	n.setSmoothingGroups 0 -1 1
)

 j83

This is one of the ways to do it in Maxscript.

       Select the objects and run/evaluate this script. :)
for o in selection do
        (
        
        theObj = o.baseObject
        numOfFaces = polyop.getnumfaces theObj
        for i = 1 to numOfFaces do
      	  (
      		  polyop.setFaceSmoothGroup theObj i 0
      	  )
        )
        completeRedraw() /*not needed, but useful*/
        gc()
        
    Or, you can do it w/ modifiers (add Smooth modifier to every object in selection, and by default, it'll clear the smoothing groups ([b]and seems to use much less memory[/b]).

    (
	if selection.count >= 1 then
		(
			for o in selection do if  superClassOf  o == geometryClass do
			(	
				addModifier o (Smooth autosmooth: off) 
				convertToPoly o
			)
		)
	)

That was awesome! Works perfect. Thank you so much!

 j83

Glad to hear! Helping others helps me get better at Maxscript, so it’s a win-win!