Test name propagation to geometric entities
(tmpdir)
| 2579 | |
| 2580 | |
| 2581 | def 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 |