[CAM] Adaptive roughing/overhang detection #18880
Draft
+333
−31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request was initially going to be an implementation of adaptive roughing (click one button, creates adaptive toolpaths for roughing the entire model), but there's an argument to be made for approaching it slightly differently as a starting point.
Part of an "adaptive roughing" algorithm is automatically adjusting the machining area as Z changes- due to overhangs, steps, and/or sloped walls, you obviously can't just take the pocket openings at the top of the model and project down. That's what's partially/jankily implemented in the branch attached to this pull request- automatically finding all areas that can be machined at a given Z height, accounting for steps, slopes, overhangs, etc. More details below for those that want to test. The basic algorithm is to slice the model at the Z cutting height, then subtractively project all of the faces above the cut down onto the outside profile of the model. The resulting areas are deemed machinable.
I'm thinking that's a good amount for a pull request on its own- add an option/checkbox to the adaptive operation that causes it to take the curves provided as bounding boxes and adjusting the area to be machined at every stepdown so it neither cuts into the model at that depth nor attempts to machine areas that are unreachable due to (eg) overhangs.
Generally looking for dev feedback that I'm on the right track before spending a bunch more time on this. Some specific questions I'm wondering a bit on:
Relevant feature request: #6607
Details for testing:
The code is currently very much proof of concept (also a ton of false starts and TODOs in there if you actually look at it- would all be fixed prior to an actual pull request). To use it:
The result should generate a toolpath for all pockets in the model at the final depth selected. I haven't implemented iterating over the different depths yet, so right now it's just showing one "step" of the process. Currently it only works for pockets (inside cut region), not the outside of the model.
Example- you can see the pocket on the left is cut out to the area that can be machined at that depth, and the pocket on the right is restricted by the overhangs:
Same thing, but with a lower cut height- note how the left pocket shrunk with the tapered sides, right pocket is exactly the same boundary: