global nbFaces = (getNumFaces $)
global facesVertices = #()
global duplicateFaceArray = #()
----------------------------------------------------------
-- Progress Bar
----------------------------------------------------------
rollout pgbar "Get Duplicate Faces"
(
progressBar pgb value:0 orient:#horizontal color:(color 0 128 128) pos: width:220
)
----------------------------------------------------------
-- Return 1 if faces are duplicated
----------------------------------------------------------
function DuplicateFace fv1 fv2 =
(
local f1a = # (fv1.x, fv1.y, fv1.z)
local f2a = # (fv2.x, fv2.y, fv2.z)
sort f1a
sort f2a
-- compare array
if (f1a == f2a and f1a == f2a and f1a == f2a) then return 1 else return 0
)
-- Store faces vertex indexes
for i = 1 to nbFaces do
facesVertices = getFace $ i
createDialog pgbar width:250 height:50
-- Loop all faces one by one and check if they are duplicated or not
for f1 = 1 to nbFaces do
(
-- If face not already flagged as duplicated
if ((findItem duplicateFaceArray f1) == 0) then
(
for f2 = (f1+1) to nbFaces do
(
--if ((DuplicateFace facesVertices facesVertices)==1) then
if (facesVertices == facesVertices) then
(
append duplicateFaceArray f2
exit
)
)
)
current_percent = 100*f1/nbFaces
pgbar.pgb.value = current_percent
)
setFaceSelection $ duplicateFaceArray
(
--change this value if the script is deleting too few or too many faces
local limit = 0.01
local obj = selection
fn p3Equal p3a p3b = --"close enough" for point3 values
(
local pm = limit / 2.0
if (p3b > (p3a - pm)) and (p3b < (p3a + pm)) and
(p3b > (p3a - pm)) and (p3b < (p3a + pm)) and
(p3b > (p3a - pm)) and (p3b < (p3a + pm))
then
true
else
false
)
(
local polyList = #{}
polyCount = polyOp.getNumFaces obj
polyList.count = polyCount
for p = 1 to polyCount - 1 do
(
if not polyListthen
(
polyLoc = polyOp.getFaceCenter obj p
for np = p + 1 to polyCount do
(
npolyLoc = polyOp.getFaceCenter obj np
if p3Equal polyLoc npolyLoc then
polyList = true
)
)
)
--could be replaced with a setFaceSelection if required
polyOp.deleteFaces obj polyList
)
)
I am having hte same issue with replciated polygons. I took the steps of:
1) Your object is a Editable Mesh (collasped, not an object with an Edit Mesh modifier on the top)
2) Your object is selected
3) You have performed a vertices weld before. The script identifies a duplicate face when it has the same 3 vertices as another existing face.
and ran the script but got this error:
is there something I am doing wrong or perhaps a version compatibility issue? I'm running 2017 max.
Cheers
check and try this:
http://www.scriptspot.com/3ds-max/scripts/find-coinstances
Ronel Katigbak Pabico
3D Generalist / Animator / Renderer/ Graphics Designer
Autodesk Student Ambassador Platinum
YouTube Channel l Linked l Facebook l Blogs
Can't find what you're looking for? Ask the community or share your knowledge.