RC: Create a boundary curve

I am looking for a way to create a “boundary” curve from collection of curves.
In a manual way I can use CurveBooleanUnion command and pick all regions, but how to do it in RC just by having a collection of different curves (closed and non-closed).
Example is enclosed.

CurveBoolean.pdf (2.9 KB)
CurveBooleanUnion.3dm (45.6 KB)

Thanks in advance,

Something like this work?

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino

crvs=[rs.coercecurve(crvID) for crvID in crvIDs]
breps = Rhino.Geometry.Brep.CreatePlanarBreps(crvs, tol)
if breps:
    for brep in breps:
        if loop:
            if boundaryID: sc.doc.Objects.Select(boundaryID)

Hmm, I guess this only works if the curves are actually split at the intersections, if they just cross, it fails… :confounded: Back to the drawing board…


Thanks, Mitch.

I have noticed that this approach works only if curve is meeting another curve at its end point.
See example below - CurveBoolean works however Brep.CreatePlaneBrep doesn’t.
I need to get resulting regions, so basically functionality of AllRegions option in Rhino CurveBoolean command.

How to get to the same effect in RC?
Does it mean that Brep.CreatePlaneBrep needs to be improved?

P.S. It seems that Brep.Split method is also not working in RC if limits are intersecting -> see enclosed.
Bug_Split.3dm (73.3 KB)
(limits in green)


Yep, I noticed that the same day. I actually spent a whole lot of time after that trying to improve the script, but unfortunately, I ran into a lot of walls. In order for my original method using curves to work, all the curves have to first be split with each other, and then you have to somehow determine which parts to keep and which parts to throw away. What I ended up before I quit that direction worked with a bunch of isolated open overlapping curves (as your example above), but not with for example 2 closed overlapping rectangles…

Then I decided instead to try to create a single planar surface larger than the curves, split the surface with the curves and merge the parts. In theory, that should also work, but I ran into a problem and didn’t finish. I’ll try to have a look this afternoon and see if I can debug my problem…


I remember that @dale or @stevebaer have been working on this, but not sure if it related to split of the surface or Brep.
In my opinion, User should not do this analysis himself, Split and CreatePlanarBrep should work for all curves.


@Dmitriy - I figured out one problem, here is my current working version, I still need to refine it so that it works in any plane - right now it’s limited to World XY. All curves must be coplanar. It will be slow if there are a lot of curves, it is the surface splitting operation that takes time. Chuck must be using a far more sophisticated method for getting outlines in the CurveBoolean command for it to go as fast as it does.

Edit - OK, here is a version that should work with a collection of coplanar curves in any plane…

CurveBooleanOutline.py (3.0 KB)

Let me know how it works… --Mitch

Hello @Helvetosaur

Apologizing for a delayed reply.
I have checked your solution and it works pretty well. However I have checked it only with rather small amount of curves.

Brep.CreatePlaneBrep is still not working with free-end curves, so I wonder if this has been reported as Bug?
maybe @dale can comment here…


I’m confused - what is this? Do you mean Brep.CreatePlanarBreps? If so, can you detail the problem?


– Dale

Hi @dale

yes, Brep.CreatePlanarBreps. Sorry for misnaming…
Basically, this method doesn’t work with free-end curves. Example picture is posted above.
However CurveBoolean native Rhino command with the same curves works good.


Yep, this true.

– Dale

Hi @dale
So, does it mean that this method will be enhanced to accept free-end curves or?


Hi @Dmitriy,

No, the function in question will not be enhanced, as it does what it was designed to do.

If you have a bunch of overlapping curve, you’ll need to clean them up by finding a closed region. When you have this, then use Brep.CreatePlanarBreps.

– Dale