From 7331d681538d2bd2e3ddd9846fac0bdf1862097a Mon Sep 17 00:00:00 2001 From: Lorenz Neureuter Date: Sun, 17 Oct 2021 18:46:54 -0400 Subject: [PATCH 1/2] paramAt - handle trimmed curves (#686) --- cadquery/occ_impl/shapes.py | 2 +- tests/test_cadquery.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) 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)] From 7413044ab13e7fd93f744b17bce0585f7bdfc07a Mon Sep 17 00:00:00 2001 From: AU Date: Tue, 19 Oct 2021 08:54:37 +0200 Subject: [PATCH 2/2] Pin HDF5 for now --- conda/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/conda/meta.yaml b/conda/meta.yaml index c402c3849..edccc18e0 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -16,6 +16,7 @@ requirements: run: - python {{ environ.get('PYTHON_VERSION') }} - ocp 7.5.2 + - hdf5 1.10.6 *1114 - pyparsing 2.* - ezdxf - ipython