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

Function test_fused_assembly_top_level_only

tests/test_exporters.py:214–234  ·  view source on GitHub ↗

Tests the assembly with only a top level shape and no children. The resulting STEP is imported again to test it.

(tmpdir)

Source from the content-addressed store, hash-verified

212
213
214def test_fused_assembly_top_level_only(tmpdir):
215 """
216 Tests the assembly with only a top level shape and no children.
217 The resulting STEP is imported again to test it.
218 """
219
220 # Create the assembly
221 body = Workplane().box(10, 10, 10)
222 assy = Assembly(body)
223
224 # Export the assembly
225 step_path = os.path.join(tmpdir, "top_level_only_fused_assembly.step")
226 assy.save(
227 path=str(step_path),
228 exportType=exporters.ExportTypes.STEP,
229 mode=exporters.assembly.ExportModes.FUSED,
230 )
231
232 # Import the assembly and make sure it acts as expected
233 model = importers.importStep(step_path)
234 assert model.solids().size() == 1
235
236
237def test_fused_assembly_top_level_with_children(tmpdir):

Callers

nothing calls this directly

Calls 7

saveMethod · 0.95
WorkplaneClass · 0.90
AssemblyClass · 0.90
boxMethod · 0.80
importStepMethod · 0.80
sizeMethod · 0.45
solidsMethod · 0.45

Tested by

no test coverage detected