MCPcopy Index your code
hub / github.com/CadQuery/cadquery / testSphereCustom

Method testSphereCustom

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

Source from the content-addressed store, hash-verified

2537 self.assertEqual(1, s.faces().size())
2538
2539 def testSphereCustom(self):
2540 s = Workplane("XY").sphere(
2541 10, angle1=0, angle2=90, angle3=360, centered=(False, False, False)
2542 )
2543 self.saveModel(s)
2544 self.assertEqual(1, s.solids().size())
2545 self.assertEqual(2, s.faces().size())
2546
2547 # check that the bottom corner is where we expect it for all possible combinations of centered
2548 radius = 10
2549 for (xopt, xval), (yopt, yval), (zopt, zval) in product(
2550 zip((True, False), (0, radius)), repeat=3
2551 ):
2552 s = Workplane().sphere(radius, centered=(xopt, yopt, zopt))
2553 self.assertEqual(s.size(), 1)
2554 self.assertTupleAlmostEquals(
2555 s.val().Center().toTuple(), (xval, yval, zval), 3
2556 )
2557 # check centered=True produces the same result as centered=(True, True, True)
2558 for val in (True, False):
2559 s0 = Workplane().sphere(radius, centered=val)
2560 self.assertEqual(s0.size(), 1)
2561 s1 = Workplane().sphere(radius, centered=(val, val, val))
2562 self.assertEqual(s0.size(), 1)
2563 self.assertTupleAlmostEquals(
2564 s0.val().Center().toTuple(), s1.val().Center().toTuple(), 3
2565 )
2566
2567 def testSpherePointList(self):
2568 s = (

Callers

nothing calls this directly

Calls 10

saveModelMethod · 0.95
WorkplaneClass · 0.85
sphereMethod · 0.80
sizeMethod · 0.45
solidsMethod · 0.45
facesMethod · 0.45
toTupleMethod · 0.45
CenterMethod · 0.45
valMethod · 0.45

Tested by

no test coverage detected