Tests if the STEP import works correctly with nested subassemblies.
(tmpdir)
| 1270 | |
| 1271 | |
| 1272 | def test_nested_subassembly_step_import(tmpdir): |
| 1273 | """ |
| 1274 | Tests if the STEP import works correctly with nested subassemblies. |
| 1275 | """ |
| 1276 | |
| 1277 | # Create a simple assembly |
| 1278 | assy = cq.Assembly() |
| 1279 | assy.add(cq.Workplane().box(10, 10, 10), name="box_1") |
| 1280 | |
| 1281 | # Create a simple subassembly |
| 1282 | subassy = cq.Assembly() |
| 1283 | subassy.add(cq.Workplane().box(5, 5, 5), name="box_2", loc=cq.Location(10, 10, 10)) |
| 1284 | |
| 1285 | # Nest the subassembly |
| 1286 | assy.add(subassy) |
| 1287 | |
| 1288 | # Export and then re-import the nested assembly STEP |
| 1289 | with chdir(tmpdir): |
| 1290 | assy.export("nested_assembly_step.step") |
| 1291 | imported_assy = cq.Assembly.importStep("nested_assembly_step.step") |
| 1292 | |
| 1293 | # Check the locations |
| 1294 | assert imported_assy.children[0].loc.toTuple()[0] == (0.0, 0.0, 0.0) |
| 1295 | assert imported_assy.children[1].objects["box_2"].loc.toTuple()[0] == ( |
| 1296 | 10.0, |
| 1297 | 10.0, |
| 1298 | 10.0, |
| 1299 | ) |
| 1300 | |
| 1301 | |
| 1302 | @pytest.mark.parametrize("kind", ["step", "xml", "xbf"]) |
nothing calls this directly
no test coverage detected