Test untilNextFace and untilLastFace options of Workplane.cutBlind()
(self)
| 3564 | self.assertEqual(part_section.faces().size(), 2) |
| 3565 | |
| 3566 | def testCutBlindUntilFace(self): |
| 3567 | """ |
| 3568 | Test untilNextFace and untilLastFace options of Workplane.cutBlind() |
| 3569 | """ |
| 3570 | # Basic test to see if it yields same results as regular cutBlind for similar use case |
| 3571 | wp_ref = ( |
| 3572 | Workplane("XY") |
| 3573 | .box(40, 10, 2) |
| 3574 | .pushPoints([(-20, 0, 5), (0, 0, 5), (20, 0, 5)]) |
| 3575 | .box(10, 10, 10) |
| 3576 | ) |
| 3577 | |
| 3578 | wp_ref_regular_cut = ( |
| 3579 | wp_ref.faces(">X[2]") |
| 3580 | .workplane(centerOption="CenterOfMass") |
| 3581 | .rect(2, 2) |
| 3582 | .cutBlind(-10) |
| 3583 | ) |
| 3584 | wp = ( |
| 3585 | wp_ref.faces(">X[2]") |
| 3586 | .workplane(centerOption="CenterOfMass") |
| 3587 | .rect(2, 2) |
| 3588 | .cutBlind("last") |
| 3589 | ) |
| 3590 | |
| 3591 | self.assertAlmostEqual(wp_ref_regular_cut.val().Volume(), wp.val().Volume()) |
| 3592 | |
| 3593 | wp_last = ( |
| 3594 | wp_ref.faces(">X[4]") |
| 3595 | .workplane(centerOption="CenterOfMass") |
| 3596 | .rect(2, 2) |
| 3597 | .cutBlind("last") |
| 3598 | ) |
| 3599 | wp_next = ( |
| 3600 | wp_ref.faces(">X[4]") |
| 3601 | .workplane(centerOption="CenterOfMass") |
| 3602 | .rect(2, 2) |
| 3603 | .cutBlind("next") |
| 3604 | ) |
| 3605 | |
| 3606 | self.assertTrue(wp_last.val().Volume() < wp_next.val().Volume()) |
| 3607 | |
| 3608 | # multiple wire cuts |
| 3609 | |
| 3610 | wp = ( |
| 3611 | wp_ref.faces(">X[4]") |
| 3612 | .workplane(centerOption="CenterOfMass", offset=0) |
| 3613 | .rect(2.5, 2.5, forConstruction=True) |
| 3614 | .vertices() |
| 3615 | .rect(1, 1) |
| 3616 | .cutBlind("last") |
| 3617 | ) |
| 3618 | |
| 3619 | self.assertTrue(wp.faces().size() == 50) |
| 3620 | |
| 3621 | with self.assertRaises(ValueError): |
| 3622 | Workplane("XY").box(10, 10, 10).center(20, 0).box(10, 10, 10).faces( |
| 3623 | ">X[1]" |
nothing calls this directly
no test coverage detected