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)
| 105 | |
| 106 | |
| 107 | def 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 | |
| 134 | def test_nested_fused_assembly(tmpdir): |