Notifications
Clear all

[Closed] Zero face selected and deleted script

I am working on a 3ds max project and this time, require rule is no zero face – is a triangle that has all vertices in a straight line. Modeller sometime snap and make mistake so leave the face alone.

So I am writing a small script trying to check the whole model, selected and delete them all.

Could anyone help me with this snippet

Thanks for any help

6 Replies
 JHN

I think I would calculate the polygon surface area, if it’s below a certain small value put it up for deletion.

-Johan

thanks but could you give me a snippet, that will be a great help

I am not a Max user so doesnt have foundation of max and max script. All I could do is try to understand the code and embed it into tool.

something like this… slightly inefficient as it could collect the tiny faces and then delete them all in one go, but it’s a good start %)

only works on editable mesh / editable poly objects… if it needs to be done on an edit poly modifier, I think additional code is needed.

control the minimum face size with the ‘threshold’ value


(
	threshold = 3.0
	if (classOf $ == Editable_mesh) then (
		for i = $.numfaces to 1 by -1 do (
			if ((meshop.getFaceArea $ i) < threshold) do (
				meshop.deleteFaces $ #{i}
			)
		)
		update $
	)
	else if (classOf $ == Editable_Poly) then (
		for i = $.numfaces to 1 by -1 do (
			if ((polyop.getFaceArea $ i) < threshold) do (
				polyop.deleteFaces $ #{i}
			)
		)
		update $
	)
)

Thanks for your great snippet

The model is convert to editable poly before running checking, so it wont get any issue.

Thanks again for your help :rolleyes:

excellent – you’re welcome

I have tested and see that only editable mesh could be used to check these kind of faces. Editable poly could not detect these faces.

It work great now and I have embed it into our workflow :applause: