Exports an assembly with unit="MM" and outputUnit="M" and verifies the STEP file header declares meters, and that the correct units are present.
(tmp_path_factory)
| 980 | |
| 981 | |
| 982 | def test_step_export_assembly_output_unit(tmp_path_factory): |
| 983 | """ |
| 984 | Exports an assembly with unit="MM" and outputUnit="M" and verifies |
| 985 | the STEP file header declares meters, and that the correct units are present. |
| 986 | """ |
| 987 | tmpdir = tmp_path_factory.mktemp("output_unit_assy") |
| 988 | m_path = os.path.join(tmpdir, "assy_output_unit_meters.step") |
| 989 | |
| 990 | assy = cq.Assembly() |
| 991 | assy.add(cq.Workplane().box(10.0, 10.0, 10.0), name="box") |
| 992 | exportAssembly(assy, m_path, unit="MM", outputUnit="M") |
| 993 | |
| 994 | with open(m_path, "r") as f: |
| 995 | content = f.read() |
| 996 | |
| 997 | assert "MILLI" not in content |
| 998 | assert "METRE" in content |
| 999 | assert "(-5.E-03,-5.E-03,-5.E-03)" in content |
| 1000 | |
| 1001 | |
| 1002 | def test_step_roundtrip_unit(tmp_path_factory): |
nothing calls this directly
no test coverage detected