From b96eb8a255f3fe7dd79dabb0dd4b1a8cfaec9c8e Mon Sep 17 00:00:00 2001 From: Matti Eiden Date: Sat, 17 Jun 2023 11:50:30 +0300 Subject: [PATCH] Fix sketch solver line_point method relative/absolute mixup (#1336) * Sketch: Fix line_point implementation Enable assert that fails without the fix ( issue #1127 ) * Change channel order --------- Co-authored-by: AU --- cadquery/occ_impl/sketch_solver.py | 2 +- tests/test_sketch.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cadquery/occ_impl/sketch_solver.py b/cadquery/occ_impl/sketch_solver.py index e6e3ac8a5..bf75b15a1 100644 --- a/cadquery/occ_impl/sketch_solver.py +++ b/cadquery/occ_impl/sketch_solver.py @@ -84,7 +84,7 @@ def arc_point(x, val): def line_point(x, val): - return x[:2] + val * x[2:] + return x[:2] + val * (x[2:] - x[:2]) def arc_first_tangent(x): diff --git a/tests/test_sketch.py b/tests/test_sketch.py index 786db8682..7ea754051 100644 --- a/tests/test_sketch.py +++ b/tests/test_sketch.py @@ -640,7 +640,7 @@ def test_constraint_solver(): midpoint = (seg2.startPoint() + seg2.endPoint()) / 2 - (midpoint - seg1.startPoint()).Length == approx(2) + assert (midpoint - seg1.startPoint()).Length == approx(2) s5 = ( Sketch()