Skip to content

Commit 6869dc6

Browse files
authored
Fix parenthesis bug in _isCoPlanar function (#1451)
* Add test demonstrating parenthesis bug * Fix parenthesis bug in `_isCoPlanar` function
1 parent 2504d6b commit 6869dc6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

cadquery/cq.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ def _isCoPlanar(f0, f1):
570570
return False
571571

572572
# test if p1 is on the plane of f0 (offset of planes)
573-
return abs(n0.dot(p0.sub(p1)) < self.ctx.tolerance)
573+
return abs(n0.dot(p0.sub(p1))) < self.ctx.tolerance
574574

575575
def _computeXdir(normal):
576576
"""

tests/test_cadquery.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,6 +1613,10 @@ def testMultiFaceWorkplane(self):
16131613
self.assertAlmostEqual(o.y, 0.0, 3)
16141614
self.assertAlmostEqual(o.z, 0.5, 3)
16151615

1616+
# Test creation with non-co-planar faces fails
1617+
with raises(ValueError):
1618+
w = s.faces("+Y").workplane()
1619+
16161620
def testTriangularPrism(self):
16171621
s = Workplane("XY").lineTo(1, 0).lineTo(1, 1).close().extrude(0.2)
16181622
self.saveModel(s)

0 commit comments

Comments
 (0)