| 2028 | |
| 2029 | |
| 2030 | def 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]) |