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

Function test_point_on_line

tests/test_assembly.py:2272–2288  ·  view source on GitHub ↗
(simple_assy2)

Source from the content-addressed store, hash-verified

2270
2271
2272def test_point_on_line(simple_assy2):
2273
2274 assy = simple_assy2
2275
2276 assy.constrain("b1", "Fixed")
2277 assy.constrain("b2@faces@>Z", "FixedAxis", (0, 2, 1))
2278 assy.constrain("b2@faces@>X", "FixedAxis", (1, 0, 0))
2279 assy.constrain("b2@faces@>X", "b1@edges@>>Z and >>Y", "PointOnLine")
2280
2281 assy = assy.solve()
2282
2283 w = cq.Workplane().add(assy.toCompound())
2284
2285 assert w.solids("<Z").val().Center().Length == pytest.approx(0)
2286 assert w.solids(">Z").val().Center().z == pytest.approx(0.5)
2287 assert w.solids(">Z").val().Center().y == pytest.approx(0.5)
2288 assert w.solids(">Z").val().Center().x == pytest.approx(0.0)
2289
2290
2291def test_axis_constraint(simple_assy2):

Callers

nothing calls this directly

Calls 7

toCompoundMethod · 0.80
constrainMethod · 0.45
solveMethod · 0.45
addMethod · 0.45
CenterMethod · 0.45
valMethod · 0.45
solidsMethod · 0.45

Tested by

no test coverage detected