From 1ed08a2e439c71d4cd54b543a112f9e31cd3b009 Mon Sep 17 00:00:00 2001 From: tarman3 Date: Mon, 10 Nov 2025 09:34:49 +0200 Subject: [PATCH] CAM: Geom - isVertical for BSpineSurface --- src/Mod/CAM/Path/Geom.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/Mod/CAM/Path/Geom.py b/src/Mod/CAM/Path/Geom.py index b554c9ae37..4215cf7e68 100644 --- a/src/Mod/CAM/Path/Geom.py +++ b/src/Mod/CAM/Path/Geom.py @@ -177,11 +177,14 @@ def isVertical(obj): return isVertical(obj.Surface.Direction) if isinstance(obj.Surface, Part.SurfaceOfRevolution): return isHorizontal(obj.Surface.Direction) - if not isinstance(obj.Surface, Part.BSplineSurface): - Path.Log.info( - translate("PathGeom", "face %s not handled, assuming not vertical") - % type(obj.Surface) - ) + if isinstance(obj.Surface, Part.BSplineSurface): + # simple face after scale + vertEdges = [e for e in obj.Edges if isVertical(e)] + return len(vertEdges) == 2 and len(obj.Edges) == 4 + + Path.Log.info( + translate("PathGeom", "face %s not handled, assuming not vertical") % type(obj.Surface) + ) return None if obj.ShapeType == "Edge": @@ -189,14 +192,14 @@ def isVertical(obj): return isVertical(obj.Vertexes[1].Point - obj.Vertexes[0].Point) if isinstance(obj.Curve, (Part.Circle, Part.Ellipse)): return isHorizontal(obj.Curve.Axis) - if isinstance(obj.Curve, Part.BezierCurve): - # the current assumption is that a bezier curve is vertical if its end points are vertical + if isinstance(obj.Curve, (Part.BezierCurve, Part.BSplineCurve)): + # the current assumption is that + # a curve is vertical if its end points are vertical return isVertical(obj.Curve.EndPoint - obj.Curve.StartPoint) - if isinstance(obj.Curve, Part.BSplineCurve): - Path.Log.info( - translate("PathGeom", "edge %s not handled, assuming not vertical") - % type(obj.Curve) - ) + + Path.Log.info( + translate("PathGeom", "edge %s not handled, assuming not vertical") % type(obj.Curve) + ) return None Path.Log.error(translate("PathGeom", "isVertical(%s) not supported") % obj)