gumyr / build123d

A python CAD programming library
Apache License 2.0
402 stars 75 forks source link

Does `Face.to_pln()` create the correct normal? #58

Closed gumyr closed 1 year ago

gumyr commented 1 year ago
from build123d import *

box = Solid.make_box(1, 1, 1)
bottom = box.faces().sort_by(Axis.Z)[0]
bottom_pln = Plane(bottom.to_pln())
print(f"{bottom.normal_at()=}")
print(f"{bottom_pln.z_dir=}")

returns:

bottom.normal_at()=Vector: (-0.0, -0.0, -1.0)
bottom_pln.z_dir=Vector: (0.0, 0.0, 1.0)

which confirms the plane normal doesn't follow the face normal.

gumyr commented 1 year ago

Fixed by flipping the resulting plane to match normals.