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

Method testMakeShellSolid

tests/test_cadquery.py:3989–4012  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3987 self.assertEqual(len(res_edge.ctx.pendingWires), 0)
3988
3989 def testMakeShellSolid(self):
3990
3991 c0 = math.sqrt(2) / 4
3992 vertices = [[c0, -c0, c0], [c0, c0, -c0], [-c0, c0, c0], [-c0, -c0, -c0]]
3993 faces_ixs = [[0, 1, 2, 0], [1, 0, 3, 1], [2, 3, 0, 2], [3, 2, 1, 3]]
3994
3995 faces = []
3996 for ixs in faces_ixs:
3997 lines = []
3998 for v1, v2 in zip(ixs, ixs[1:]):
3999 lines.append(
4000 Edge.makeLine(Vector(*vertices[v1]), Vector(*vertices[v2]))
4001 )
4002 wire = Wire.combine(lines)[0]
4003 faces.append(Face.makeFromWires(wire))
4004
4005 shell = Shell.makeShell(faces)
4006 solid = Solid.makeSolid(shell)
4007
4008 self.assertTrue(shell.isValid())
4009 self.assertTrue(solid.isValid())
4010
4011 self.assertEqual(len(solid.Vertices()), 4)
4012 self.assertEqual(len(solid.Faces()), 4)
4013
4014 def testIsInsideSolid(self):
4015 # test solid

Callers

nothing calls this directly

Calls 10

VectorClass · 0.85
appendMethod · 0.80
makeLineMethod · 0.80
makeShellMethod · 0.80
makeSolidMethod · 0.80
isValidMethod · 0.80
combineMethod · 0.45
makeFromWiresMethod · 0.45
VerticesMethod · 0.45
FacesMethod · 0.45

Tested by

no test coverage detected