(self)
| 575 | Plane(origin=(0, 0, 0), xDir=(1, 0, 0), normal=(0, 0, 0)) |
| 576 | |
| 577 | def testPlaneMethods(self): |
| 578 | # Test error checking |
| 579 | p = Plane(origin=(0, 0, 0), xDir=(1, 0, 0), normal=(0, 1, 0)) |
| 580 | with self.assertRaises(ValueError): |
| 581 | p.toLocalCoords("box") |
| 582 | with self.assertRaises(NotImplementedError): |
| 583 | p.mirrorInPlane([Solid.makeBox(1, 1, 1)], "Z") |
| 584 | |
| 585 | # Test translation to local coordinates |
| 586 | local_box = Workplane(p.toLocalCoords(Solid.makeBox(1, 1, 1))) |
| 587 | local_box_vertices = [(v.X, v.Y, v.Z) for v in local_box.vertices().vals()] |
| 588 | target_vertices = [ |
| 589 | (0, -1, 0), |
| 590 | (0, 0, 0), |
| 591 | (0, -1, 1), |
| 592 | (0, 0, 1), |
| 593 | (1, -1, 0), |
| 594 | (1, 0, 0), |
| 595 | (1, -1, 1), |
| 596 | (1, 0, 1), |
| 597 | ] |
| 598 | for i, target_point in enumerate(target_vertices): |
| 599 | self.assertTupleAlmostEquals(target_point, local_box_vertices[i], 7) |
| 600 | |
| 601 | # Test mirrorInPlane |
| 602 | mirror_box = Workplane(p.mirrorInPlane([Solid.makeBox(1, 1, 1)], "Y")[0]) |
| 603 | mirror_box_vertices = [(v.X, v.Y, v.Z) for v in mirror_box.vertices().vals()] |
| 604 | target_vertices = [ |
| 605 | (0, 0, 1), |
| 606 | (0, 0, 0), |
| 607 | (0, -1, 1), |
| 608 | (0, -1, 0), |
| 609 | (-1, 0, 1), |
| 610 | (-1, 0, 0), |
| 611 | (-1, -1, 1), |
| 612 | (-1, -1, 0), |
| 613 | ] |
| 614 | for i, target_point in enumerate(target_vertices): |
| 615 | self.assertTupleAlmostEquals(target_point, mirror_box_vertices[i], 7) |
| 616 | |
| 617 | def testLocation(self): |
| 618 |
nothing calls this directly
no test coverage detected