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

Function test_fused_assembly_with_one_part

tests/test_exporters.py:163–183  ·  view source on GitHub ↗

Tests the ability to fuse an assembly with only one part present. The resulting STEP is imported again to test it.

(tmpdir)

Source from the content-addressed store, hash-verified

161
162
163def test_fused_assembly_with_one_part(tmpdir):
164 """
165 Tests the ability to fuse an assembly with only one part present.
166 The resulting STEP is imported again to test it.
167 """
168 # Create the single-part assembly
169 assy = Assembly()
170 body = Workplane().box(10, 10, 10)
171 assy.add(body, color=Color(1, 0, 0), name="body")
172
173 # Export the assembly
174 step_path = os.path.join(tmpdir, "single_part_fused_assembly.step")
175 assy.save(
176 path=str(step_path),
177 exportType=exporters.ExportTypes.STEP,
178 mode=exporters.assembly.ExportModes.FUSED,
179 )
180
181 # Import the assembly and make sure it acts as expected
182 model = importers.importStep(step_path)
183 assert model.solids().size() == 1
184
185
186def test_fused_assembly_glue_tol(tmpdir):

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected