MCPcopy
hub / github.com/CadQuery/cadquery / testAreaNthSelector_Shells

Method testAreaNthSelector_Shells

tests/test_selectors.py:959–983  ·  view source on GitHub ↗

Selecting one of three shells with the smallest surface area

(self)

Source from the content-addressed store, hash-verified

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 """

Callers

nothing calls this directly

Calls 7

WorkplaneClass · 0.85
eachpointMethod · 0.80
rarrayMethod · 0.45
shellsMethod · 0.45
valsMethod · 0.45
AreaMethod · 0.45
valMethod · 0.45

Tested by

no test coverage detected