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

Function test_fused_not_touching_assembly

tests/test_exporters.py:107–131  ·  view source on GitHub ↗

Exports as simple assembly using the "fused" STEP export mode and then imports that STEP again to validate it. This tests whether or not the fuse method correctly handles fusing solids to do not touch.

(tmpdir)

Source from the content-addressed store, hash-verified

105
106
107def test_fused_not_touching_assembly(tmpdir):
108 """
109 Exports as simple assembly using the "fused" STEP export mode
110 and then imports that STEP again to validate it. This tests whether
111 or not the fuse method correctly handles fusing solids to do not touch.
112 """
113
114 # Create the sample assembly
115 assy = Assembly()
116 body = Workplane().box(10, 10, 10)
117 assy.add(body, color=Color(1, 0, 0), name="body")
118 pin = Workplane().center(8, 8).cylinder(radius=2, height=20)
119 assy.add(pin, color=Color(0, 1, 0), name="pin")
120
121 # Export the assembly
122 step_path = os.path.join(tmpdir, "fused_not_touching.step")
123 assy.save(
124 path=str(step_path),
125 exportType=exporters.ExportTypes.STEP,
126 mode=exporters.assembly.ExportModes.FUSED,
127 )
128
129 # Import the assembly and make sure it acts as expected
130 model = importers.importStep(step_path)
131 assert model.solids().size() == 2
132
133
134def test_nested_fused_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