Last active
May 11, 2016 19:43
-
-
Save paulwinex/956678ed9c3a07247b32 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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