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

Function test_fused_assembly

tests/test_exporters.py:81–104  ·  view source on GitHub ↗

Exports as simple assembly using the "fused" STEP export mode and then imports that STEP again to validate it.

(tmpdir)

Source from the content-addressed store, hash-verified

79
80
81def test_fused_assembly(tmpdir):
82 """
83 Exports as simple assembly using the "fused" STEP export mode
84 and then imports that STEP again to validate it.
85 """
86
87 # Create the sample assembly
88 assy = Assembly()
89 body = Workplane().box(10, 10, 10)
90 assy.add(body, color=Color(1, 0, 0), name="body")
91 pin = Workplane().center(2, 2).cylinder(radius=2, height=20)
92 assy.add(pin, color=Color(0, 1, 0), name="pin")
93
94 # Export the assembly
95 step_path = os.path.join(tmpdir, "fused.step")
96 assy.save(
97 path=str(step_path),
98 exportType=exporters.ExportTypes.STEP,
99 mode=exporters.assembly.ExportModes.FUSED,
100 )
101
102 # Import the assembly and make sure it acts as expected
103 model = importers.importStep(step_path)
104 assert model.solids().size() == 1
105
106
107def test_fused_not_touching_assembly(tmpdir):

Callers

nothing calls this directly

Calls 11

addMethod · 0.95
saveMethod · 0.95
AssemblyClass · 0.90
WorkplaneClass · 0.90
ColorClass · 0.90
boxMethod · 0.80
cylinderMethod · 0.80
centerMethod · 0.80
importStepMethod · 0.80
sizeMethod · 0.45
solidsMethod · 0.45

Tested by

no test coverage detected