PrusaSlicer
PrusaSlicer copied to clipboard
Cut: Keep results as parts of current object
This is a small change that adds the option to keep the cut piece in-place as a part of the current object. I'd been using this in my own build to add automatic color changes at layers in my MMU2 prints. But updating it to work with the new angled cut features in the 2.6 alpha now enables fun stuff like this (made from two cuts on pyramid.stl from the default Gallery).

The UX for this PR adds an As part checkbox to the Cut dialog. When checked, the connector and placement options are disabled, since they really don't seem to make sense with keeping a single, untranslated object. Clicking either of the two As part options will result in an identical multi-part volume, but it seemed best to present it this way given the structure of the current dialog and code. Most of the code in this PR is just the GUI integration, since the change to the actual cut operation is so small. Here's what the UX looks like.

/CC @YuSanka
I did a quick search to see if anyone else might find this sort of feature useful, and it seems like #9473 asked for the same basic functionality (although described it a bit differently). But a more interesting case was presented in #9472, where they wanted to remove part of a model, but leave the rest of it at the same height intact. So, I used Cut -> As part to slice the model at the base, Split to break the top half into multiple parts, and then I selected and deleted that one part like so.

Of course it would be nice to just directly select the parts one wants to cut versus keep, and thus not to risk any errors creeping in from repairing all the extra cut points in the mesh. That stated, this still seems like a pretty workable solution to the use case described in the feature request.
Hi @jschuh, I like this idea. Especially for MMU, it makes perfect sense. I would mention that BambuStudio has this option. Thanks.
Ah, I wasn't aware that Bambu had this feature. Now that I'm looking at their implementation the code is very similar to an older version I'd written. However, the version in this PR is much cleaner, since @YuSanka's Model cutting code refactor for 2.6 is just far better structured for these sorts of feature enhancements.
That stated, I did just think of an obvious simplification for this PR that I think I'll iterate on today.
Okay, I simplified the cutting code (that portion is now a six line change), but the core functionality is still identical.
I also made the checkboxes behave more consistently with the rest of the UI. Here's how it works:
- Checking As parts sets the Keep and As part boxes checked for both halves, unchecks Place on cut and Flip, and disables Add/Edit connectors.
- Unchecking As parts for one part also unchecks As parts for the other part and re-enables Add/Edit connectors.
- If As parts is currently checked, unchecking Keep or checking Place on cut or Flip will uncheck both As part boxes (and re-enable Add/Edit connectors if Keep is checked for both halves, which was the normal behavior).
- Adding any connectors disables As parts.
This is what the dialog now looks like when slicing a single object into parts:

Closing since the intended functionality of this PR was landed as part of b40473b.