Select objects with no smoothing group

Hello,
i need to do select objects which has polygons of no smoothing group.
and im very noob in maxscript.

fn selectFacesWithNoSG theObject =
(
polyOp.setFaceSelection theObject (for f = 1 to polyop.getNumFaces theObject where polyop.getFaceSmoothGroup theObject f == 0 collect f)
)<code>
 
I dont know why its not working..
thank you in advance.

Comments

Comment viewing options

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

.

This works for me:

(
	obj = selection[1]
	facesBA = #{1..(polyop.GetNumFaces obj)}
	noSMGFacesArr = for f in facesBA where (polyop.getFaceSmoothGroup obj f) == 0 collect f
	if noSMGFacesArr.count != 0 do
		polyop.setFaceSelection obj noSMGFacesArr
	redrawViews()
)
x_OL's picture

I searched such feature

@miauu:
I searched exactly such feature - to check if all polygons has smooth groups before export. Work good in 2020. Thanks :)

miauu's picture

.

I am glad that the script is useful to you. :)

jahman's picture

.

he needs to select objects not faces ;)

NodesWithNoSGfaces = for obj in selection where canConvertTo obj Editable_mesh collect
(
	local found = false
	local tri = snapshotAsMesh obj
 
	for f=1 to tri.numfaces while not found where getFaceSmoothGroup tri f == 0 do
	(
		found = true
	)
 
	free tri
 
	if found then obj else dontCollect	
)
 
select NodesWithNoSGfaces
alnoman's picture

.

@jahman
Thank you man! This works great!! like charm!!

And
@miauu
I have posted this thread expecting your replay actually.
and you make it!. you have done reading my mind becoz when i tried to find objects and i will surely look for culprit polygons with noSG. thaks.

Both script is important!!

miauu's picture

.

Most important is that you have working tools.

miauu's picture

.

Yep. My bad. :)

Comment viewing options

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