Tests the cut function by itself to catch the case where a Solid object is passed.
(self)
| 1693 | self.assertEqual(12, t.faces().size()) |
| 1694 | |
| 1695 | def testCut(self): |
| 1696 | """ |
| 1697 | Tests the cut function by itself to catch the case where a Solid object is passed. |
| 1698 | """ |
| 1699 | s = Workplane(Plane.XY()) |
| 1700 | currentS = s.rect(2.0, 2.0).extrude(0.5) |
| 1701 | toCut = s.rect(1.0, 1.0).extrude(0.5) |
| 1702 | |
| 1703 | resS = currentS.cut(toCut.val()) |
| 1704 | |
| 1705 | self.assertEqual(10, resS.faces().size()) |
| 1706 | |
| 1707 | with self.assertRaises(ValueError): |
| 1708 | currentS.cut(toCut.faces().val()) |
| 1709 | |
| 1710 | # Test syntactic sugar [__sub__ method] |
| 1711 | sugar = currentS - toCut.val() |
| 1712 | self.assertEqual(resS.faces().size(), sugar.faces().size()) |
| 1713 | |
| 1714 | # test ValueError on no solid found |
| 1715 | s0 = Workplane().hLine(1).vLine(1).close() |
| 1716 | with raises(ValueError): |
| 1717 | s0.cut(toCut.val()) |
| 1718 | |
| 1719 | def testIntersect(self): |
| 1720 | """ |