Tests the ability to remove a part from an assembly.
()
| 2423 | |
| 2424 | |
| 2425 | def test_assembly_remove_part(): |
| 2426 | """ |
| 2427 | Tests the ability to remove a part from an assembly. |
| 2428 | """ |
| 2429 | assy = cq.Assembly() |
| 2430 | assy.add(box(1, 1, 1), name="part1") |
| 2431 | assy.add(box(2, 2, 2), name="part2", loc=cq.Location(5.0, 5.0, 5.0)) |
| 2432 | |
| 2433 | # Make sure we have the correct number of children (2 parts) |
| 2434 | assert len(assy.children) == 2 |
| 2435 | assert len(assy.objects) == 3 |
| 2436 | |
| 2437 | # Remove the first part |
| 2438 | assy.remove("part1") |
| 2439 | |
| 2440 | # Make sure we have the correct number of children (1 part) |
| 2441 | assert len(assy.children) == 1 |
| 2442 | assert len(assy.objects) == 2 |
| 2443 | |
| 2444 | |
| 2445 | def test_assembly_remove_subassy(): |