From 6869dc625bf29e098204fcd71bbe1025fd553644 Mon Sep 17 00:00:00 2001 From: Evan Grim Date: Sun, 3 Dec 2023 06:34:25 -0600 Subject: [PATCH] Fix parenthesis bug in `_isCoPlanar` function (#1451) * Add test demonstrating parenthesis bug * Fix parenthesis bug in `_isCoPlanar` function --- cadquery/cq.py | 2 +- tests/test_cadquery.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cadquery/cq.py b/cadquery/cq.py index 65101678e..f9396fc49 100644 --- a/cadquery/cq.py +++ b/cadquery/cq.py @@ -570,7 +570,7 @@ def _isCoPlanar(f0, f1): return False # test if p1 is on the plane of f0 (offset of planes) - return abs(n0.dot(p0.sub(p1)) < self.ctx.tolerance) + return abs(n0.dot(p0.sub(p1))) < self.ctx.tolerance def _computeXdir(normal): """ diff --git a/tests/test_cadquery.py b/tests/test_cadquery.py index e0081ecfa..bc605f92a 100644 --- a/tests/test_cadquery.py +++ b/tests/test_cadquery.py @@ -1613,6 +1613,10 @@ def testMultiFaceWorkplane(self): self.assertAlmostEqual(o.y, 0.0, 3) self.assertAlmostEqual(o.z, 0.5, 3) + # Test creation with non-co-planar faces fails + with raises(ValueError): + w = s.faces("+Y").workplane() + def testTriangularPrism(self): s = Workplane("XY").lineTo(1, 0).lineTo(1, 1).close().extrude(0.2) self.saveModel(s)