Tests a nested assembly being exported as a single, fused solid. The resulting STEP is imported again to test it.
(tmpdir)
| 132 | |
| 133 | |
| 134 | def test_nested_fused_assembly(tmpdir): |
| 135 | """ |
| 136 | Tests a nested assembly being exported as a single, fused solid. |
| 137 | The resulting STEP is imported again to test it. |
| 138 | """ |
| 139 | # Create the nested assembly |
| 140 | assy = Assembly() |
| 141 | body = Workplane().box(10, 10, 10) |
| 142 | assy.add(body, color=Color(1, 0, 0), name="body") |
| 143 | pins = Assembly() |
| 144 | pin1 = Workplane().center(8, 8).cylinder(radius=2, height=20) |
| 145 | pin2 = Workplane().center(-8, -8).cylinder(radius=2, height=20) |
| 146 | pins.add(pin1, color=Color(0, 1, 0), name="pin1") |
| 147 | pins.add(pin2, color=Color(0, 0, 1), name="pin2") |
| 148 | assy.add(pins, name="pins") |
| 149 | |
| 150 | # Export the assembly |
| 151 | step_path = os.path.join(tmpdir, "nested_fused_assembly.step") |
| 152 | assy.save( |
| 153 | path=str(step_path), |
| 154 | exportType=exporters.ExportTypes.STEP, |
| 155 | mode=exporters.assembly.ExportModes.FUSED, |
| 156 | ) |
| 157 | |
| 158 | # Import the assembly and make sure it acts as expected |
| 159 | model = importers.importStep(step_path) |
| 160 | assert model.solids().size() == 3 |
| 161 | |
| 162 | |
| 163 | def test_fused_assembly_with_one_part(tmpdir): |