diff --git a/cadquery/occ_impl/shapes.py b/cadquery/occ_impl/shapes.py index 5de129f20..8123587c6 100644 --- a/cadquery/occ_impl/shapes.py +++ b/cadquery/occ_impl/shapes.py @@ -1341,7 +1341,7 @@ def paramAt(self: Mixin1DProtocol, d: float) -> float: curve = self._geomAdaptor() l = GCPnts_AbscissaPoint.Length_s(curve) - return GCPnts_AbscissaPoint(curve, l * d, 0).Parameter() + return GCPnts_AbscissaPoint(curve, l * d, curve.FirstParameter()).Parameter() def tangentAt( self: Mixin1DProtocol, diff --git a/tests/test_cadquery.py b/tests/test_cadquery.py index 5c37b3bc5..7cdbb511d 100644 --- a/tests/test_cadquery.py +++ b/tests/test_cadquery.py @@ -4597,6 +4597,19 @@ def testPositionAt(self): self.assertTupleAlmostEquals(p0.toTuple(), p2.toTuple(), 6) self.assertTupleAlmostEquals(p1.toTuple(), (0, 1, 0), 6) + # test with arc of circle + e = Edge.makeCircle(1, (0, 0, 0), (0, 0, 1), 90, 180) + p0 = e.positionAt(0.0) + p1 = e.positionAt(1.0) + assert p0.toTuple() == approx((0.0, 1.0, 0.0)) + assert p1.toTuple() == approx((-1.0, 0.0, 0.0)) + + w = Wire.assembleEdges([e]) + p0 = w.positionAt(0.0) + p1 = w.positionAt(1.0) + assert p0.toTuple() == approx((0.0, 1.0, 0.0)) + assert p1.toTuple() == approx((-1.0, 0.0, 0.0)) + def testTangengAt(self): pts = [(0, 0), (-1, 1), (-2, 0), (-1, 0)]