MCPcopy Index your code
hub / github.com/CadQuery/cadquery / test_step_export_assembly_output_unit

Function test_step_export_assembly_output_unit

tests/test_assembly.py:982–999  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

980
981
982def 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
1002def test_step_roundtrip_unit(tmp_path_factory):

Callers

nothing calls this directly

Calls 3

addMethod · 0.95
exportAssemblyFunction · 0.90
boxMethod · 0.80

Tested by

no test coverage detected