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

Function test_PointInPlane_3_parts

tests/test_assembly.py:2030–2044  ·  view source on GitHub ↗
(box_and_vertex)

Source from the content-addressed store, hash-verified

2028
2029
2030def test_PointInPlane_3_parts(box_and_vertex):
2031
2032 cylinder_height = 2
2033 cylinder = cq.Workplane().circle(0.1).extrude(cylinder_height)
2034 box_and_vertex.add(cylinder, name="cylinder")
2035 box_and_vertex.constrain("box@faces@>Z", "cylinder@faces@<Z", "Plane")
2036 box_and_vertex.constrain("vertex", "cylinder@faces@>Z", "PointInPlane")
2037 box_and_vertex.constrain("vertex", "box@faces@>X", "PointInPlane")
2038 box_and_vertex.solve()
2039 solve_result_check(box_and_vertex._solve_result)
2040 vertex_translation_part = (
2041 box_and_vertex.children[0].loc.wrapped.Transformation().TranslationPart()
2042 )
2043 assert vertex_translation_part.Z() == pytest.approx(1.5 + cylinder_height)
2044 assert vertex_translation_part.X() == pytest.approx(0.5)
2045
2046
2047@pytest.mark.parametrize("param1", [-1, 0, 2])

Callers

nothing calls this directly

Calls 6

solve_result_checkFunction · 0.85
extrudeMethod · 0.80
circleMethod · 0.45
addMethod · 0.45
constrainMethod · 0.45
solveMethod · 0.45

Tested by

no test coverage detected