Add syntactic sugar for boolean operations
This commit is contained in:
@ -1306,6 +1306,10 @@ class TestCadQuery(BaseTest):
|
||||
with self.assertRaises(ValueError):
|
||||
currentS.cut(toCut.faces().val())
|
||||
|
||||
# Test syntactic sugar [__sub__ method]
|
||||
sugar = currentS - toCut.val()
|
||||
self.assertEqual(resS.faces().size(), sugar.faces().size())
|
||||
|
||||
def testIntersect(self):
|
||||
"""
|
||||
Tests the intersect function.
|
||||
@ -1333,6 +1337,10 @@ class TestCadQuery(BaseTest):
|
||||
with self.assertRaises(ValueError):
|
||||
b1.intersect(b2.faces().val())
|
||||
|
||||
# Test syntactic sugar [__mul__ method]
|
||||
sugar = b1 * b2
|
||||
self.assertEqual(resS.val().Volume(), sugar.val().Volume())
|
||||
|
||||
def testBoundingBox(self):
|
||||
"""
|
||||
Tests the boudingbox center of a model
|
||||
@ -2175,6 +2183,10 @@ class TestCadQuery(BaseTest):
|
||||
with self.assertRaises(ValueError):
|
||||
resS.union(toUnion.faces().val())
|
||||
|
||||
# Test syntactic sugar [__add__ method]
|
||||
sugar = currentS + toUnion
|
||||
self.assertEqual(resS.faces().size(), sugar.faces().size())
|
||||
|
||||
def testCombine(self):
|
||||
s = Workplane(Plane.XY())
|
||||
objects1 = s.rect(2.0, 2.0).extrude(0.5).faces(">Z").rect(1.0, 1.0).extrude(0.5)
|
||||
|
Reference in New Issue
Block a user