Skip to content

Instantly share code, notes, and snippets.

@Hoikohroh
Created March 18, 2017 10:57
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Hoikohroh/6abbb24e2cd387f1679f5c835831bd47 to your computer and use it in GitHub Desktop.
Maxscript: check_over4verts
/*
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