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

Function test_step_roundtrip_unit

tests/test_assembly.py:1002–1018  ·  view source on GitHub ↗
(tmp_path_factory)

Source from the content-addressed store, hash-verified

1000
1001
1002def test_step_roundtrip_unit(tmp_path_factory):
1003
1004 tmpdir = tmp_path_factory.mktemp("output_unit_assy")
1005 m_path = os.path.join(tmpdir, "assy_roundtrip_unit.step")
1006
1007 assy = cq.Assembly()
1008 assy.add(cq.Workplane().box(1.0, 1.0, 1.0), name="box")
1009 assy.save(m_path, unit="MM", outputUnit="M")
1010
1011 assy2 = cq.Assembly.load(m_path, unit="M")
1012 assert assy2.box.obj.Volume() == approx((1e-3) ** 3)
1013
1014 assy3 = cq.Assembly.load(m_path, unit="CM")
1015 assert assy3.box.obj.Volume() == approx((1e-1) ** 3)
1016
1017 assy4 = cq.Assembly.load(m_path, unit="MM")
1018 assert assy4.box.obj.Volume() == approx((1) ** 3)
1019
1020
1021def test_assembly_step_import(tmpdir, subshape_assy):

Callers

nothing calls this directly

Calls 5

addMethod · 0.95
saveMethod · 0.95
boxMethod · 0.80
loadMethod · 0.80
VolumeMethod · 0.80

Tested by

no test coverage detected