PDA

View Full Version : Zero face selected and deleted script


ghostlake114
10-17-2008, 09:22 AM
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.

http://i35.photobucket.com/albums/d152/ghostlake114/zeroface.jpg

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

JHN
10-17-2008, 01:42 PM
I think I would calculate the polygon surface area, if it's below a certain small value put it up for deletion.

-Johan

ghostlake114
10-17-2008, 04:12 PM
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.

ZeBoxx2
10-17-2008, 06:10 PM
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 $
)
)

ghostlake114
10-17-2008, 06:26 PM
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:

ZeBoxx2
10-18-2008, 02:16 AM
excellent - you're welcome :)

ghostlake114
10-18-2008, 03:14 AM
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:

CGTalk Moderation
10-18-2008, 03:14 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.