We are trying to achieve something similar to Cooking Simulator, for slicing food. We have already implemented it successfully, but now we want to improve it by limiting slicing when the result mesh is too small; to avoid generating tiny peaces that are causing problems for us. We are already preventing slicing an object which volume (calculated from the mesh) is less than a defined threshold; and it works. The problem is when we slice an object which volume is bigger than the threshold, but one of the sliced (pos or neg) is less than this volume threshold. In that case we would like to avoid the slice, and keep the original object.
Is there a way, using the exposed API to achieve that?
We can't figure out a way to do that without modifing the framwork (which is something we would like to avoid). Thank you very much in advance.
I know, I already answered you in the email. But to also have the answer here I'll repeat:
I do not see a way to do that without modifying the framework code. But the changes could be not very significant.
You can make the method BzSliceTryResult ApplyChanges(SliceTry sliceTry) protected and virtual. Then override it:
protected override BzSliceTryResult ApplyChanges(SliceTry sliceTry) { for (int i = 0; i < sliceTry.items.Length; i++) { var res = sliceTry.items[i].meshDissector; var negMesh = res.SliceResultNeg.GenerateMesh(); var posMesh = res.SliceResultPos.GenerateMesh(); // or to avoid mesh generation you can analyze res.SliceResultNeg result. if (wrong volume size) { return null; } } return base.ApplyChanges(sliceTry); }