| 5006 | self.assertTrue(Workplane().box(1, 1, 1).box(2, 2, 1).end(2).objects == []) |
| 5007 | |
| 5008 | def testCutEach(self): |
| 5009 | |
| 5010 | # base shape: |
| 5011 | w = Workplane().box(3, 2, 2) |
| 5012 | # cutter: |
| 5013 | c = Workplane().box(2, 2, 2).val() |
| 5014 | # cut all the corners off |
| 5015 | w0 = w.vertices().cutEach(lambda loc: c.located(loc)) |
| 5016 | # we are left with a 1x2x2 box: |
| 5017 | self.assertAlmostEqual(w0.val().Volume(), 4, 3) |
| 5018 | |
| 5019 | # test error on no solid found |
| 5020 | w1 = Workplane().hLine(1).vLine(1).close() |
| 5021 | with raises(ValueError): |
| 5022 | w1.cutEach(lambda loc: c.located(loc)) |
| 5023 | |
| 5024 | def testCutBlind(self): |
| 5025 | # cutBlind is already tested in several of the complicated tests, so this method is short. |