Is there a bug in Face.makePlane()

32 views
Skip to first unread message

Paul Nelson

unread,
Apr 3, 2025, 8:09:07 PMApr 3
to CadQuery
Should width & length be swapped (see red below):
(when I use it, it seems like X & Y are swapped from what I would expect)

@classmethod
def makePlane( cls, length: Optional[float] = None, width: Optional[float] = None, basePnt: VectorLike = (0, 0, 0), dir: VectorLike = (0, 0, 1), ) -> "Face": basePnt = Vector(basePnt) dir = Vector(dir) pln_geom = gp_Pln(basePnt.toPnt(), dir.toDir()) if length and width: pln_shape = BRepBuilderAPI_MakeFace( pln_geom, -width * 0.5, width * 0.5, -length * 0.5, length * 0.5 ).Face() else: pln_shape = BRepBuilderAPI_MakeFace(pln_geom).Face() return cls(pln_shape)

Lorenz

unread,
Apr 4, 2025, 11:16:05 PMApr 4
to CadQuery
The following creates four similar faces.

from cadquery import Sketch, Face
from cadquery.func import plane, face, rect

w = 1
l = 2

f1 = Face.makePlane(l, w)
f2 = plane(w, l)
f3 = Sketch().rect(w, l).val()
f4 = face(rect(w, l))



Only the Face makePlane method swaps the order of the width, length parameters.  
It is also the only one of these that is undocumented.

I guess the parameter order is what you find unexpected.  Agree it doesn't follow the more usual convention found here in Sketch, free function API but there is no bug AFAICT.

You might try moving to the `plane` function unless you require say the `dir` parameter of the Face method.
Reply all
Reply to author
Forward
0 new messages