Avoid duplicate boolean clean passes#1308
Conversation
|
The logging changes - |
|
Fair point. I’ll trim this PR down so it’s focused on the batch fuse behavior and remove the logging/context micro-optimizations. The case I was looking at was generated geometry where a lot of simple box-like solids get combined, for example grid/fixture/block-style models. But I agree that when the model is really a set of 2D footprints with a common height, doing the union in 2D and extruding afterward is probably the better approach. I’ll update the PR so the scope is clearer and less speculative. |
e9c2155 to
a8889e4
Compare
|
I tightened the PR further and force-pushed the reduced version. This no longer changes logging, location context handling, edge parallelization, or OCCT glue. I also dropped the box-specific optimized path after checking it more closely, since glue is not the right general answer for overlapping boxes. The PR now only avoids a duplicate clean pass after boolean operations that already clean inside the shared boolean helper. The existing boolean path is unchanged, and I added regression tests for overlapping box batches, mixed curved additions, and rotated additions. Full test suite is green, and the updated PR description has the reduced benchmark numbers. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1308 +/- ##
==========================================
+ Coverage 95.98% 96.17% +0.18%
==========================================
Files 35 36 +1
Lines 13096 13551 +455
==========================================
+ Hits 12570 13032 +462
+ Misses 526 519 -7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
53f01dd to
a8889e4
Compare
gumyr
left a comment
There was a problem hiding this comment.
Thanks for identifying this, what appears to be, redundant call to clean.
| clean_already_done = SkipClean.clean | ||
|
|
||
| if SkipClean.clean: | ||
| if SkipClean.clean and not clean_already_done: |
There was a problem hiding this comment.
It seems as though this clean operation should be removed entirely. Either a single object is in the Compound (should that be cleaned?) or the fuse will have already cleaned the result.
| clean_already_done = SkipClean.clean | ||
|
|
||
| if SkipClean.clean and not isinstance(sum_shape, list): | ||
| if ( |
There was a problem hiding this comment.
Same comment, it seems that this clean is redundant. Either a single object is present or the results were already cleaned.
| # ) | ||
|
|
||
| if self._obj is not None and clean: | ||
| if self._obj is not None and clean and not clean_already_done: |
There was a problem hiding this comment.
Same comment here, I think clean is redundant here. I'm guessing clean was added to _bool_op after this code was written and the duplicate clean never identified/removed..
a8889e4 to
9d346dc
Compare
|
I pushed an update for these review comments. The direct I kept cleanup for the non-boolean builder integration paths because removing it entirely broke Validation is updated in the PR body. Full test suite and pylint both pass locally. |
|
Thank you! |
Avoid running a second clean pass after boolean operations that already clean their result.
The shared boolean helper already applies ShapeUpgrade_UnifySameDomain when SkipClean.clean is enabled. This removes the caller-level clean from direct Shape and Compound additions. Builder context integration now skips the caller-level clean for add, subtract, and intersect paths that call the shared boolean helper, while retaining cleanup for non-boolean integrations that do not go through that helper.
To keep the scope tight, this does not change logging behavior and does not enable OCCT glue.
Validation:
uv run --extra development pytest(1988 passed, 2 skipped)uv run --extra development pytest tests/test_benchmarks.py::test_ppp_0106 tests/test_algebra.py tests/test_build_common.py tests/test_build_part.py tests/test_direct_api/test_compound.py tests/test_direct_api/test_shape.py(292 passed)uv run --extra development pytest tests/test_benchmarks.py::test_ppp_0106 tests/test_examples.py -k ppp0106(1 passed)uv run --extra development pylint --rcfile=.pylintrc --fail-under=9.5 src/build123d