# Is there a way to select Non-Planar Faces?

The "Clean up" toolbox can detect non-planar faces and split them. But I'd like to have a way to view them first! Is there an easy method of mass-selecting non-planar faces (like a trait selection)?

Thanks in advance, I hope someone helps me out!

• Could you add a screencapture of your mesh? – Faceb Faceb Dec 21 '16 at 11:23

Here is a script to run in edit mode, It looks at all faces with > 3 vertices, defines a plane from the first 3 verts [v.co for v in ngon.verts[:3]] as input coords to determine its normal and ngon.verts[0].co is a point on the plane

If absolute distance from rest of vertices in ngon to defined plane is less than some tolerance the face is planar.

import bpy
import bmesh
from mathutils.geometry import (
distance_point_to_plane,
normal)

context = bpy.context
obj = context.edit_object
mesh = obj.data

TOL = 0.001

# select None
bpy.ops.mesh.select_all(action='DESELECT')
bm = bmesh.from_edit_mesh(mesh)
ngons = [f for f in bm.faces if len(f.verts) > 3]

for ngon in ngons:
# define a plane from first 3 points
co = ngon.verts[0].co
norm = normal([v.co for v in ngon.verts[:3]])

ngon.select =  not all(
[abs(distance_point_to_plane(v.co, co, norm)) < TOL
for v in ngon.verts[3:]])

bmesh.update_edit_mesh(mesh)


Result of running script with TOL = 0.1 on mesh made of cylinder, uv sphere, torus and monkey primitives.

• Thank you for the script, I ran it but sadly it didn't help the cause much. Reason being - it selects way more faces that it thinks are non-planar, but at the same time Blender's cleanup finds far less of those. – eigos Dec 21 '16 at 14:22
• The script has a tolerance TOL which is the distance from the vert to the "face plane", just like split non planar faces operator has an angle_limit (default 5 degs). Perhaps I could change up to check angle rather than distance to match clean up. Added a pic of result of running script using TOL = 0.1. It selects pretty much all the monkey if TOL = 0.00001 and none of the others. It selects no faces after "split non planar faces" clean up.... I'm happy with it. – batFINGER Dec 21 '16 at 17:58
• Very interesting, great answer. – VRM Dec 22 '16 at 4:06