Complex surface trimming...help!

I have a surface with a whole pile of curves projected to it, like this:

(Note most of the curves are closed ellipses, and there is one long open curve.)

I need to trim away everything except the colored section shown here:

But I’m having real trouble finding an efficient, reliable way to do this. I had some success using the SrfSplit component, passing in the surface and all the curves, and then just picking the first surface in the resulting list. This is probably very inefficient, and doesn’t always work (I have many tens of these surface/curve sets in different orientations in space. I think depending on the order of the SrfSplit result (a very long list of surfaces) is probably unwise.

Logically, what I would like is to take my surface, punch holes in it with the ellipses, then split it with the long open curve. Or maybe split the surface in two with the long curve first, then “nibble” away at the curved edge with the ellipses.

Alternatively, is there a way to just deal with the curves first and avoid surface/brep operations? That would be more efficient and reliable.

This is one of those situations, it seems, when a human can do it easily, but scripting it is problematic…

Any advice is much appreciated.

Hello,

Please post some geometry !

Just looking at your sample picture, I’d you with SrfSplit and take the output surface with the largest area. But dfficult to tell without seeing the whole picture.

Apologies, I meant to post some geometry and, well, other stuff happened. :slight_smile:

Here’s a file with just one of these situations from a set of 14, ready to be trimmed:
ReadyToTrim.3dm (1.9 MB)

But thanks for the idea, I hadn’t considered calculating areas to find the piece I need, and I think that will work reliably! (Although it still seems wildly inefficient to me.) If I make my original surface only up to that long open curve, THEN do the SrfSplit with the ellipses, then I’m guaranteed (I think) that the largest area will be the piece I need. So thank you!

Alas, on my pretty-fast computer, calculating just one “set” of these (there are 14 of them in the set I’m looking at right now, and there will be a couple dozen sets like that), the SrfSplit takes around 8 seconds, then calculating areas takes another 5 seconds. Surely there’s a snappier, more efficient way to do this? Maybe not…

If your pieces are planar, then you can use Region Union and Region Difference to only work with curves (still the first split by the line is required).

I added a sorting procedure at the beginning : if you have several surfaces/curves in the same file you have to make sure in the SurfaceSplit that they are scattered in different branches, to avoid long calculations.

ReadyToTrim.3dm (429.5 KB)
ReadyToTrim.gh (17.4 KB)

Thanks again! More great ideas. In particular, Region Union on the ellipses BEFORE Region Difference is probably an efficiency win. (I had tried Region Difference with the raw ellipses, and it took over 5 MINUTES on a set of 14.) Also, Curve Side, I don’t think I’ve seen that component before, but wish I had.

Thanks. I think I can get there now, reliably if not speedily.