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

Method testClosedShell

tests/test_cadquery.py:2419–2442  ·  view source on GitHub ↗

Create a hollow box

(self)

Source from the content-addressed store, hash-verified

2417 s4.shell(1)
2418
2419 def testClosedShell(self):
2420 """
2421 Create a hollow box
2422 """
2423 s1 = Workplane("XY").box(2, 2, 2).shell(-0.1)
2424 self.assertEqual(12, s1.faces().size())
2425 self.assertTrue(s1.val().isValid())
2426
2427 s2 = Workplane("XY").box(2, 2, 2).shell(0.1)
2428 self.assertEqual(32, s2.faces().size())
2429 self.assertTrue(s2.val().isValid())
2430
2431 pts = [(1.0, 0.0), (0.3, 0.2), (0.0, 0.0), (0.3, -0.1), (1.0, -0.03)]
2432
2433 s3 = Workplane().polyline(pts).close().extrude(1).shell(-0.05)
2434 self.assertTrue(s3.val().isValid())
2435
2436 s4_shape = Workplane("XY").box(2, 2, 2).val()
2437 # test that None and empty list both work and are equivalent
2438 s4_shell_1 = s4_shape.hollow(faceList=None, thickness=-0.1)
2439 s4_shell_2 = s4_shape.hollow(faceList=[], thickness=-0.1)
2440 # this should be the same as the first shape
2441 self.assertEqual(len(s4_shell_1.Faces()), s1.faces().size())
2442 self.assertEqual(len(s4_shell_2.Faces()), s1.faces().size())
2443
2444 def testOpenCornerShell(self):
2445 s = Workplane("XY").box(1, 1, 1)

Callers

nothing calls this directly

Calls 12

WorkplaneClass · 0.85
boxMethod · 0.80
isValidMethod · 0.80
extrudeMethod · 0.80
polylineMethod · 0.80
hollowMethod · 0.80
shellMethod · 0.45
sizeMethod · 0.45
facesMethod · 0.45
valMethod · 0.45
closeMethod · 0.45
FacesMethod · 0.45

Tested by

no test coverage detected