Compound containing empty Compound raises during Volume()
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- python
- Domain
- computer-graphics
Research direction
Start in cadquery/occ_impl/shapes.py at Shape._mass_calc_function, around the line shown in the traceback, and reproduce the nested-empty-compound example from the issue. Verify that Volume() completes for a compound containing an empty compound while the inner empty compound still reports 0.0.
Written by the indexing model from the issue text.
Description
When computing the volume of a compound that itself contains an empty compound, a StopIteration exception is raised.
However the volume of the inner empty compound itself is computed to be 0.0 as expected.
To Reproduce
from cadquery.occ_impl.shapes import compound
empty_compound = compound()
empty_volume = empty_compound.Volume() # returns 0.0
print("empty compound volume:", empty_volume)
bad = compound(empty_compound) # top-level non-empty, first child empty
volume = bad.Volume() # raises StopIteration
print("bad compound volume:", volume) # this line is never reached
Output:
empty compound volume: 0.0
Traceback (most recent call last):
File "/tmp/cq _vol_test.py", line 9, in <module>
volume = bad.Volume() # raises StopIteration
File "/home/john/src/klu/.venv/lib/python3.14/site-packages/cadquery/occ_impl/shapes.py", line 1118, in Volume
return Shape.computeMass(self, tol)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File "/home/john/src/klu/.venv/lib/python3.14/site-packages/cadquery/occ_impl/shapes.py", line 824, in computeMass
calc_function = Shape._mass_calc_function(obj)
File "/home/john/src/klu/.venv/lib/python3.14/site-packages/cadquery/occ_impl/shapes.py", line 804, in _mass_calc_function
child = next(iter(child))
StopIteration
Environment
OS: Arch Linux
Was CadQuery installed using Conda?: No, installed with pip
Version: 2.8.0, Python 3.14.6
- Dominant language
- Python
- Stars
- 5.8k
- Forks
- 544
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 5
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CadQuery/cadquery
-
OCCT8
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
assembly enhancement OCC feature
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
bug usability
Difficulty 3/5 1-2 days Newbie friendliness 66/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in CadQuery/cadquery
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100