Selecting one of three shells with the smallest surface area
(self)
| 957 | ) |
| 958 | |
| 959 | def testAreaNthSelector_Shells(self): |
| 960 | """ |
| 961 | Selecting one of three shells with the smallest surface area |
| 962 | """ |
| 963 | |
| 964 | sizes_iter = iter([10.0, 20.0, 30.0]) |
| 965 | |
| 966 | def next_box_shell(loc): |
| 967 | size = next(sizes_iter) |
| 968 | return Workplane().box(size, size, size).val().located(loc) |
| 969 | |
| 970 | workplane_shells = Workplane().rarray(10, 1, 3, 1).eachpoint(next_box_shell) |
| 971 | |
| 972 | selected_shells = workplane_shells.shells(selectors.AreaNthSelector(0)) |
| 973 | |
| 974 | self.assertEqual( |
| 975 | len(selected_shells.vals()), |
| 976 | 1, |
| 977 | msg="Failed to select the smallest shell: wrong N shells", |
| 978 | ) |
| 979 | self.assertAlmostEqual( |
| 980 | selected_shells.val().Area(), |
| 981 | 10 * 10 * 6, |
| 982 | msg="Failed to select the smallest shell: wrong area", |
| 983 | ) |
| 984 | |
| 985 | def testAreaNthSelector_Solids(self): |
| 986 | """ |