Skip to content

Instantly share code, notes, and snippets.

@SEVEZ
Forked from paulwinex/polyCompare2.py
Created May 11, 2016 19:43
Show Gist options
  • Select an option

  • Save SEVEZ/db9e0511f821772190443cd6212eca69 to your computer and use it in GitHub Desktop.

Select an option

Save SEVEZ/db9e0511f821772190443cd6212eca69 to your computer and use it in GitHub Desktop.
def check_faces_in_the_same_place(sel=False):
objs = ls(sl=sel, type='mesh')
errors = []
for obj in objs:
areas = {}
for f in obj.f:
a = round(f.getArea(),5)
if a in areas:
areas[a].append(f)
else:
areas[a] = [f]
faces = []
for a, ff in areas.items():
if len(ff) > 1:
faces += ff
while faces:
f1 = faces.pop(0)
s1 = sorted([[round(z, 4) for z in p] for p in f1.getPoints()], key=lambda x:x[0])
for f2 in faces:
s2 = sorted([[round(z, 4) for z in p] for p in f2.getPoints()], key=lambda x:x[0])
if s1 == s2:
errors.append(f2)
return errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment