assembly.remove to remove from anywhere in assembly
- Dominant language
- Python
- Stars
- 5.8k
- Forks
- 541
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 5
Description
I have been using the assembly.remove feature and found it very useful. Would it be ok I make a small PR to make it even more useful for me.
Assembly.remove() only checks direct children. It would be useful if it searched recursively through the hierarchy, since users often don't know (or shouldn't need to know) which level of nesting a part lives at especially with imported STEP files.
```python
# Build a nested assembly: outer -> inner -> [box_a, box_b]
outer = cq.Assembly(name='outer')
inner = cq.Assembly(name='inner')
inner.add(cq.Workplane('XY').box(1, 1, 1), name='box_a')
inner.add(cq.Workplane('XY').box(2, 2, 2), name='box_b')
outer.add(inner)
# This fails — remove() only searches direct children, not recursively
outer.remove('box_a')
# ValueError: No object with name 'box_a' found in the assembly
# Workaround: remove from the direct parent
inner.remove('box_a') # works
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.