diff --git a/cadquery/occ_impl/shapes.py b/cadquery/occ_impl/shapes.py index a181fa282..3f42105fd 100644 --- a/cadquery/occ_impl/shapes.py +++ b/cadquery/occ_impl/shapes.py @@ -275,6 +275,7 @@ ShapeAnalysis_Edge, ShapeAnalysis_Wire, ShapeAnalysis_Surface, + ShapeAnalysis, ) from OCP.TopTools import TopTools_HSequenceOfShape @@ -2102,10 +2103,10 @@ def startPoint(self: Mixin1DProtocol) -> Vector: Note, circles may have the start and end points the same """ - curve = self._geomAdaptor() - umin = curve.FirstParameter() + v1, _ = TopoDS_Vertex(), TopoDS_Vertex() + ShapeAnalysis.FindBounds_s(self.wrapped, v1, _) - return Vector(curve.Value(umin)) + return Vertex(v1).Center() def endPoint(self: Mixin1DProtocol) -> Vector: """ @@ -2115,10 +2116,10 @@ def endPoint(self: Mixin1DProtocol) -> Vector: Note, circles may have the start and end points the same """ - curve = self._geomAdaptor() - umax = curve.LastParameter() + _, v2 = TopoDS_Vertex(), TopoDS_Vertex() + ShapeAnalysis.FindBounds_s(self.wrapped, _, v2) - return Vector(curve.Value(umax)) + return Vertex(v2).Center() def _approxCurve(self: Mixin1DProtocol) -> Geom_BSplineCurve: """ diff --git a/tests/test_cadquery.py b/tests/test_cadquery.py index 23cc6386b..09875368f 100644 --- a/tests/test_cadquery.py +++ b/tests/test_cadquery.py @@ -313,12 +313,12 @@ def testRotate(self): startPoint = box.faces("Z").edges(">X").first().val().startPoint().toTuple() + point = result.faces(">Z").edges(">X").first().val().endPoint().toTuple() self.assertTupleAlmostEquals( point, (0.707106781, 1.414213562, 1.0), decimal_places ) diff --git a/tests/test_shapes.py b/tests/test_shapes.py index bb34fdce5..3309093d6 100644 --- a/tests/test_shapes.py +++ b/tests/test_shapes.py @@ -475,3 +475,12 @@ def test_set_ops(simple_box): assert (simple_box.faces(">Z") | simple_box.faces("Z") & simple_box.faces("