Created
March 18, 2017 10:57
Star
You must be signed in to star a gist
Maxscript: check_over4verts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
check_over4verts | |
2017/03/18 | |
------------------------------------------------ | |
Description | |
Confirm existence of Ngon. | |
How to use | |
Select the object and execute this script. | |
1. The execution result is output to the MAXScript Listener. | |
2. If there is an object containing NGon, put the object in selected state. | |
------------------------------------------------ | |
Change log | |
2017/03/18 ver1 | |
*/ | |
if selection.count >= 1 do( | |
local mySel = selection as array | |
local censored = #() | |
local skipped = #() | |
with redraw off | |
for i in mySel do(--check over 4verts | |
if superClassOf i == GeometryClass and classof i != BoneGeometry then( | |
local face_selection = #{} | |
local base_obj = snapshot i | |
convertTo base_obj Editable_Poly | |
local num_faces = polyop.getNumFaces base_obj | |
local flag = false | |
for f = 1 to num_faces do( | |
local num_face_verts = polyop.getFaceDeg base_obj f | |
if num_face_verts > 4 do( | |
face_selection[f] = true | |
flag = true | |
) | |
) | |
if flag do( | |
append censored i | |
) | |
delete base_obj | |
)else(append skipped i) | |
) | |
-- print results | |
format "============================\nFinished\n\nchecked object : %\n" (mySel.count - skipped.count) | |
if skipped.count > 0 do( | |
format "\nskipped object : %\n" skipped.count | |
for i in skipped do(format " %\n" i.name) | |
) | |
format "\ncensored object : %\n" censored.count | |
if censored.count > 0 then( | |
for i in censored do(format " %\n" i.name) | |
)else(print " Not founded") | |
format"\nDone\n============================\n" | |
-- select censored object | |
if censored.count > 0 then(select censored) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment