Create a unit box and mirror it so that it doubles in size
(self)
| 184 | self.assertAlmostEqual(b2.findSolid().Volume(), 2, 5) |
| 185 | |
| 186 | def test_mirror_workplane(self): |
| 187 | """Create a unit box and mirror it so that it doubles in size""" |
| 188 | b2 = Workplane().box(1, 1, 1) |
| 189 | |
| 190 | # double in Z plane |
| 191 | b2 = b2.mirror(b2.faces(">Z"), union=True) |
| 192 | bbBox = b2.findSolid().BoundingBox() |
| 193 | assert [bbBox.xlen, bbBox.ylen, bbBox.zlen] == [1.0, 1.0, 2] |
| 194 | self.assertAlmostEqual(b2.findSolid().Volume(), 2, 5) |
| 195 | |
| 196 | # double in Y plane |
| 197 | b2 = b2.mirror(b2.faces(">Y"), union=True) |
| 198 | bbBox = b2.findSolid().BoundingBox() |
| 199 | assert [bbBox.xlen, bbBox.ylen, bbBox.zlen] == [1.0, 2.0, 2] |
| 200 | self.assertAlmostEqual(b2.findSolid().Volume(), 4, 5) |
| 201 | |
| 202 | # double in X plane |
| 203 | b2 = b2.mirror(b2.faces(">X"), union=True) |
| 204 | bbBox = b2.findSolid().BoundingBox() |
| 205 | assert [bbBox.xlen, bbBox.ylen, bbBox.zlen] == [2.0, 2.0, 2] |
| 206 | self.assertAlmostEqual(b2.findSolid().Volume(), 8, 5) |
| 207 | |
| 208 | def test_mirror_equivalence(self): |
| 209 | """test that the plane string, plane normal and face object perform a mirror operation in the same way""" |