Tests the assembly with a top level shape and multiple children. The resulting STEP is imported again to test it.
(tmpdir)
| 235 | |
| 236 | |
| 237 | def test_fused_assembly_top_level_with_children(tmpdir): |
| 238 | """ |
| 239 | Tests the assembly with a top level shape and multiple children. |
| 240 | The resulting STEP is imported again to test it. |
| 241 | """ |
| 242 | |
| 243 | # Create the assembly |
| 244 | body = Workplane().box(10, 10, 10) |
| 245 | assy = Assembly(body) |
| 246 | mark = Workplane().center(3, 3).cylinder(radius=1, height=10) |
| 247 | assy.add(mark, color=Color(1, 0, 0), name="mark") |
| 248 | pin = Workplane().center(-5, -5).cylinder(radius=2, height=20) |
| 249 | assy.add(pin, loc=Location(Vector(0, 0, 15)), color=Color(0, 1, 0), name="pin") |
| 250 | |
| 251 | # Export the assembly |
| 252 | step_path = os.path.join(tmpdir, "top_level_with_children_fused_assembly.step") |
| 253 | assy.save( |
| 254 | path=str(step_path), |
| 255 | exportType=exporters.ExportTypes.STEP, |
| 256 | mode=exporters.assembly.ExportModes.FUSED, |
| 257 | ) |
| 258 | |
| 259 | # Import the assembly and make sure it acts as expected |
| 260 | model = importers.importStep(step_path) |
| 261 | assert model.solids().size() == 1 |
| 262 | assert model.faces(">Z").val().Center().z == approx(25) |
| 263 | |
| 264 | |
| 265 | def test_fused_empty_assembly(tmpdir): |
nothing calls this directly
no test coverage detected