Grasshopper Solid Difference missing elements

Hi I’m trying to slice through a sweep to get panels but my GH Surface Divide is not working properly. A part of the original geometry gets lost that shouldn’t. Is this because it’s too much for GH to preview or is the script malfunctioning?
230803_Crown Model_GH curves.3dm (122.8 KB)
parapet script.gh (17.0 KB)



There is something missing in your document:

Can you check again that everything is there?

Sorry about that… here you go,

parapet script.gh (15.6 KB)
230803_Crown Model_GH curves.3dm (122.8 KB)

Still missing that one curve.

So sorry!
230803_Crown Model_GH curves WITH CURVE.3dm (122.8 KB)

Ps. I put the missing curve under the “The Curve” layer

lol you should have warned us!
on my pc grasshopper started working endlessly… I killed rhino after 15 minutes more or less…

Surely it was solid difference fault here.


Doing solid difference of a brep “minus” 220 other breps is… tricky.
First of all, it can lead to situations like this, because the math behind is trying to do all at once.
It fails in a small edge? Fails the whole boolean process, even if it took 10 minutes.
Secondly, you lose the order of your shapes, you might not care about it, but it’s good to learn good practices.
Lastly, that many boolean differences are done by a single thread (your cutters might subtract more material from already cut pieces… it HAVE to be single threaded)

… but you know what you are doing, and indeed this specific situation of yours can be optimized!



By exploding and re-matching your cutting boxes, we can create a sort of “negative” cutter, that with a boolean operation will leave only the piece you want! (the brep could have been flipped and we use solid intersection instead… old story)
Notice the brep shape and normals directions ^ .

Then, with all the cutters, we can do N times the boolean operation, multithreaded!

using System.Threading.Tasks;
---
private void RunScript(Brep brepA, List<Brep> brepB, ref object R)
  {
    int n = brepB.Count;
    double t = this.RhinoDocument.ModelAbsoluteTolerance;
    Brep[] results = new Brep[n];
    Parallel.For(0, n, (i) => {
      results[i] = (Rhino.Geometry.Brep.CreateBooleanDifference(brepA, brepB[i], t))[0];
      });
    R = results;
  }

(Note that this small script strictly expect to have clean intersecting solids, and output only the first result at [0] …)

parapet script.gh (24.9 KB)

10 seconds! We can live with that :sunglasses:

Thank you SO much! So sorry about that… haha. I’m working on a super old computer so thought the issue was coming from my end lol. This is super helpful.

Just to make sure I understood correctly, you deconstructed the “cutters” to make them more like a cookiecutter and flipped them to make sure they were cutting the right segment, right?

Yes.
Imagine a guy using a “die cutter” to create pieces out of a big sheet of plastic.
He can work only alone, and if the “die cutter” fails it mess up everything …

But, we can virtually replicate the sheet of plastic, for free.
Then we can give one copyof the big sheet of plastic to many other workers and tell them one by one to use a specific cutter to create just a single tiny piece. This is safer, and probably is faster than doing all at once even if single threaded (but it can be multithreaded easily, if we want).

Maybe working with boolean solid intersection is safer.
My method require you to properly flip the normals. If you create “cookiecutters” as closed solid you will have to handle one less variable…