-
-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loft produces unexpected faces of GeomType.BSPLINE or filter_by(Plane) should work with GeomType.BSPLINE shapes #756
Comments
Unfortunately, the OCCT CAD kernel returns these BSPLINE faces where a PLANAR face would be more appropriate. The check for planar needs to be change from just looking at the from build123d import *
from OCP.BRep import BRep_Tool
from OCP.GeomLib import GeomLib_IsPlanarSurface
from ocp_vscode import show_all
def is_face_planar(face: Face) -> bool:
surface = BRep_Tool.Surface_s(face.wrapped)
is_planar = GeomLib_IsPlanarSurface(surface, 1e-6)
return is_planar.IsPlanar()
with BuildPart() as mount:
with BuildSketch():
Rectangle((1 + 16 + 4) * MM, 20 * MM, align=(Align.MIN, Align.CENTER))
with BuildSketch(Pos(1 * MM, 0, 4 * MM)):
Rectangle(16 * MM, 20 * MM, align=(Align.MIN, Align.CENTER))
loft()
for f in mount.faces():
print(f"{f.geom_type} is planar: {is_face_planar(f)}")
I'm thinking a new property should be added to the |
I assume with the
would change to:
That looks good to me. |
…e-from-planar-faces Plane instantiation from planar Geom_BoundedSurface faces Issue #756
The following code creates the shape in the picture below:
I would like to filter out the trapezoidal faces with
mount.faces().filter_by(Plane.XZ)
, however, this returns an empty list.I have narrowed down the issue to the implemenation of the
Shape.filter_by
method, specifically theplane_parallel_predicate
. The shape being filtered needs to be both an instance ofFace
and of aGeomType.PLANE
. Theloft
creates the trapezoidal faces asGeomType.BSPLINE
, which fails the second part of the check and results in the empty list after applying the filter.I don't know whether the issue is with the
loft
creating the faces as b-splines (which maybe seems unnecessary?) or whether thefilter_by
function should be able to work with (plannar?) b-spline faces. What do you think?The text was updated successfully, but these errors were encountered: