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

Function test_name_geometries

tests/test_assembly.py:2581–2605  ·  view source on GitHub ↗

Test name propagation to geometric entities

(tmpdir)

Source from the content-addressed store, hash-verified

2579
2580
2581def test_name_geometries(tmpdir):
2582 """
2583 Test name propagation to geometric entities
2584 """
2585
2586 assy = cq.Assembly()
2587
2588 assy.add(box(1, 1, 1), name="box")
2589 assy.box.addSubshape(assy.box.obj.faces(">Z"), "top_face")
2590
2591 assy.add(plane(1, 1), name="face").face.addSubshape(assy.face.obj, name="plane_")
2592
2593 assy.add(segment((0, 0), (0, 1)), name="edge").edge.addSubshape(
2594 assy.edge.obj, name="seg_"
2595 )
2596
2597 with chdir(tmpdir):
2598 assy.save("out.step", name_geometries=True)
2599
2600 with open("out.step", "r") as f:
2601 lines = f.readlines()
2602
2603 assert len([l for l in lines if "top_face" in l]) == 2
2604 assert len([l for l in lines if "plane_" in l]) == 2
2605 assert len([l for l in lines if "seg_" in l]) == 3

Callers

nothing calls this directly

Calls 7

addMethod · 0.95
saveMethod · 0.95
planeFunction · 0.90
segmentFunction · 0.90
boxFunction · 0.85
addSubshapeMethod · 0.45
facesMethod · 0.45

Tested by

no test coverage detected