I would like to create a list of faces/polygons based on the angle of each corresponding normal. I've tried something like board.data.polygons[0].normal > 0, but that doesn't seem to work.

enter image description here

Question: How to pick the normals that are pointing downwards (-z axis) and append their associated faces/polygons to a new list?


2 Answers 2


Use Vector.angle(Vector)

To get all normals that are within 89 degrees of the -z axis in local space (down = Vector((0, 0, -1)) use face.normal.angle(down) which calculates the angle between the face normal and the local vector pointing down.

import bpy
from math import radians
from mathutils import Vector
context = bpy.context
obj = context.object
me = obj.data
down = Vector((0, 0, -1)) #  -z axis.
test_angle = radians(89) 
# list all faces with normal less than 89 degrees to down
faces = [f for f in me.polygons 
        if f.normal.angle(down) < test_angle]


Change the test_angle value to suit.


board.data.polygons[0].normalreturns a vector(x,y,z). You need to choose the axis you want to compare in your case "Z". So:

board.data.polygons[0].normal[2] < 0:
    #do something here

Note if you only want the faces pointing directly down, you have to compare to -1.0(board.data.polygons[0].normal[2] == 1.0)

  • 1
    $\begingroup$ IMO never use equality (x == 1.0) with floats, always use a tolerance. abs(x - 1.0) < TOL $\endgroup$
    – batFINGER
    Commented Dec 8, 2017 at 3:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .