Skip to content

feat: commands for merge and intersect#1665

Merged
RobPasMue merged 36 commits intoblitzfrom
feat/commands_for_merge_and_intersect
Jan 28, 2025
Merged

feat: commands for merge and intersect#1665
RobPasMue merged 36 commits intoblitzfrom
feat/commands_for_merge_and_intersect

Conversation

@smereu
Copy link
Copy Markdown
Contributor

@smereu smereu commented Jan 20, 2025

Description

This PR switches the implementation of the boolean operations unite(merge) intersect and subtract to using commands rather than core APIs.
Notes

  • The behavior of intersect -> Keep Other was flipped (wrong) in the original implementation
  • Some fringe cases (e.g. merge/intersect/subtract of coincident bodies) fail in the new implementation but work in the previous or viceversa. A number of unit tests had to be updated accordingly. @jonahrb it was great to have such extensive coverage

Issue linked

Please mention the issue number or describe the problem this pull request addresses.

Checklist

  • [ X] I have tested my changes locally.
  • [ X] I have added necessary documentation or updated existing documentation.
  • [ X ] I have followed the coding style guidelines of this project.
  • [ X] I have added appropriate unit tests.
  • [ X] I have reviewed my changes before submitting this pull request.
  • I have linked the issue or issues that are solved to the PR if any.
  • [X ] I have assigned this PR to myself.
  • [ x] I have added the minimum version decorator to any new backend method implemented.
  • [ X] I have made sure that the title of my PR follows Conventional commits style (e.g. feat: extrude circle to cylinder)

smereu and others added 3 commits January 20, 2025 13:05
Boolean operations on body were executed using the core API. For a number of reasons it is agreed to switch to command based implementation which simplifies treatment of occurrences and fixes some known issues.  Note that
1) Combine.Merge operation does not support keeping the other bodies
2) Subtract is invoked from Combine.Intersect passing subtract_from_target = true
remove files accidentally committed
@github-actions github-actions bot added the enhancement New features or code improvements label Jan 20, 2025
@smereu
Copy link
Copy Markdown
Contributor Author

smereu commented Jan 20, 2025

@RobPasMue @jonahrb @b-matteo Leaving this PR in draft mode until the API server is updated, but feel free to review and add suggestions

@smereu smereu changed the title Feat/commands for merge and intersect Feat: commands for merge and intersect Jan 21, 2025
smereu and others added 5 commits January 20, 2025 21:32
Apply style change from pre-commit and correct undefined variable
remove unnecessary files
Remove unnecessary files
@smereu smereu changed the title Feat: commands for merge and intersect feat: commands for merge and intersect Jan 21, 2025
@RobPasMue
Copy link
Copy Markdown
Member

@smereu - please add yourself as "Assignee" of the PR and modify the PR description according to the guidelines whenever you get the chance. This allows us to properly maintain the repository and easily determine features and implementations

@smereu smereu self-assigned this Jan 22, 2025
@smereu smereu marked this pull request as ready for review January 23, 2025 00:56
@smereu smereu requested a review from a team as a code owner January 23, 2025 00:56
@smereu smereu requested review from b-matteo and jonahrb January 23, 2025 00:57
Comment thread src/ansys/geometry/core/designer/body.py
Copy link
Copy Markdown
Member

@RobPasMue RobPasMue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments... I still need to process this PR more in depth. My feeling is that there are some unnecessary operations like the final if not keep_other:... or the update_design_inplace.

Comment thread src/ansys/geometry/core/designer/body.py
Comment thread src/ansys/geometry/core/designer/body.py Outdated
Comment thread tests/integration/test_design.py
Comment thread src/ansys/geometry/core/designer/body.py Outdated
smereu and others added 6 commits January 24, 2025 10:21
remove unused option
remove unused argument
For versions prior to 25.2 we have to call the core API methods for boolean since proto changes made in 25.2 are needed for the command implementation
fix use of version and mismatched arguments
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 27, 2025

Codecov Report

Attention: Patch coverage is 89.47368% with 4 lines in your changes missing coverage. Please review.

Project coverage is 91.02%. Comparing base (78bde4c) to head (c2f5c93).
Report is 1 commits behind head on blitz.

Files with missing lines Patch % Lines
src/ansys/geometry/core/designer/body.py 89.47% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            blitz    #1665      +/-   ##
==========================================
- Coverage   91.17%   91.02%   -0.15%     
==========================================
  Files          91       91              
  Lines        7924     7959      +35     
==========================================
+ Hits         7225     7245      +20     
- Misses        699      714      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Member

@RobPasMue RobPasMue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from my last comment - LGTM! Let's get it merged soon =)

Comment thread tests/integration/test_design.py Outdated
Copy link
Copy Markdown
Member

@RobPasMue RobPasMue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should revert these breaking changes - sorry, I overlooked them

Comment thread src/ansys/geometry/core/designer/body.py Outdated
Comment thread src/ansys/geometry/core/designer/body.py Outdated
Comment thread src/ansys/geometry/core/designer/body.py Outdated
Comment thread src/ansys/geometry/core/designer/body.py Outdated
@RobPasMue RobPasMue enabled auto-merge (squash) January 28, 2025 16:18
@RobPasMue RobPasMue merged commit 6cda8d6 into blitz Jan 28, 2025
@RobPasMue RobPasMue deleted the feat/commands_for_merge_and_intersect branch January 28, 2025 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New features or code improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants