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

Method testFaceIntersectedByLine

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

Source from the content-addressed store, hash-verified

3645 self.assertAlmostEqual(inner_face_area, 13.372852288495503, 5)
3646
3647 def testFaceIntersectedByLine(self):
3648 with self.assertRaises(ValueError):
3649 Workplane().box(5, 5, 5).val().facesIntersectedByLine(
3650 (0, 0, 0), (0, 0, 1), direction="Z"
3651 )
3652
3653 pts = [(-10, 0), (-5, 0), (0, 0), (5, 0), (10, 0)]
3654 shape = (
3655 Workplane()
3656 .box(20, 10, 5)
3657 .faces(">Z")
3658 .workplane()
3659 .pushPoints(pts)
3660 .box(1, 10, 10)
3661 )
3662 faces = shape.val().facesIntersectedByLine((0, 0, 7.5), (1, 0, 0))
3663 mx_face = shape.faces("<X").val()
3664 px_face = shape.faces(">X").val()
3665
3666 self.assertTrue(len(faces) == 10)
3667 # extremum faces are last or before last face
3668 self.assertTrue(mx_face in faces[-2:])
3669 self.assertTrue(px_face in faces[-2:])
3670
3671 def testExtrude(self):
3672 """

Callers

nothing calls this directly

Calls 7

WorkplaneClass · 0.85
boxMethod · 0.80
pushPointsMethod · 0.80
workplaneMethod · 0.80
valMethod · 0.45
facesMethod · 0.45

Tested by

no test coverage detected