Hi @chuck,

Was the implementation of this command cancelled?

I do not see it in RhinoCommon.
Maybe it was renamed?

As a real command it is integrated into CurveBoolean now. I don’t remember if it’s accessible via RhinoCommon, ISTR that it was, but I didn’t find it for the moment.

This might be it?
Edit - no, doesn’t look like it actually.

hm get region from a brep, that’s weird.

I need it on a curve before applying the curve boolean.

Note: before anyone suggests so scripting the curve boolean command has terrible performance. 5 mins for a single model no thanks.

You might consider trying Curve.CreateBooleanRegions.

– Dale

1 Like

Thanks @dale,

Just saw your answer here:


Uhm, @dale,

What about Rhino6?
The test method is gone and we don’t have the Rhino7 method.

Sorry, no.

– Dale

Any workaround?

You do have the CurveBoolean _AllRegions option in V6. That’s all TestGetPlanarRegions was…

yes but the performance is terrible Rhino goes in the dark (unresponsive) place.

Do you know if TestGetPlanarRegions would have been any better with your file?

I want a RhinoCommon method, not so much the command.
I usually avoid scripting commands and today I reminded myself why.

test model: 825 polysurfaces. (most closed pipes)

  • Scripting Silhouette and project commands - 5minutes

  • using python and RhinoCommon’s method for silhouette and project - 26 seconds.

Because of the inexplicable to me result of the silhouette method (returning two circles and two lines/curves from one closed pipe). I get overlapping curves after they are projected. And I cannot close them properly to use the CurveBoolean method.

I seriously believe this is a bug that needs fixing and not a new functionality to be shoved in Rhino7, like I wouldn’t buy R7 if I had it in R6.

Give me a price I’ll buy R7 now, just put it in R6. :stuck_out_tongue_winking_eye: a reasonable price.

Hmm, your pipes must be something special…

I ran the following script on 972 random curved closed pipes.

import rhinoscriptsyntax as rs
import Rhino, time

print "{} objects selected".format(count)
print "Time to create silhouettes={} sec.".format(round(time.time()-st,2))

print "Time to project silhouettes={} sec.".format(round(time.time()-st,2))


972 objects selected
Creating silhouettes
Time to create silhouettes=7.93 sec.
Time to project silhouettes=0.44 sec.


Yes it’s a part of ship’s piping system with pipes elbows t-junctions or whatever the “super marios” ( :stuck_out_tongue_winking_eye: ) call that also valves and other armature and equipment. Not just simple one surface pipes (rhino objects) with caps.

Hi @ivelin.peychev, could you post an example model with some of your pipes ? I want to try something which i wrote (TestGetPlanarRegions version for Rhino 6).

Hi @clement,

Thanks for the effort.

This is how far I’ve gotten:

import System
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino
import time

tol = sc.doc.ModelAbsoluteTolerance

def get_em_all_breps(select=False, include_lights=False, include_grips=False, include_references=False):
    modified AllObjects() method to select all selectable objects of type brep
    selection_settings = Rhino.DocObjects.ObjectEnumeratorSettings()
    selection_settings.IncludeLights = include_lights
    selection_settings.IncludeGrips = include_grips
    selection_settings.NormalObjects = True
    selection_settings.LockedObjects = False
    selection_settings.HiddenObjects = False
    selection_settings.ReferenceObjects = include_references
    #Select all brep (polysurfaces)
    selection_settings.ObjectTypeFilter = Rhino.DocObjects.ObjectType.Brep 
    # this gets object references
    #.Geometry to get the geometry
    #.ObjectId to get the uuid
    e = sc.doc.Objects.GetObjectList(selection_settings)
    return e

def TST():
    all_objs = get_em_all_breps()
    #print type(all_objs)
    #print all_objs[0]
    all_objs = [obj for obj in all_objs if rs.IsPolysurface(obj)]
    surf = rs.GetObject("select projection plane surface: ",rs.filter.surface)
    #com_str_project = ""
    for i in range(len(all_objs)):
        brep_geo = all_objs[i].BrepGeometry
        #print brep_geo
        sil = Rhino.Geometry.Silhouette.Compute.Overloads[Rhino.Geometry.GeometryBase,Rhino.Geometry.SilhouetteType, Rhino.Geometry.Vector3d, System.Double, System.Double](brep_geo, Rhino.Geometry.SilhouetteType.TangentProjects, Rhino.Geometry.Vector3d.ZAxis, sc.doc.ModelAbsoluteTolerance, sc.doc.ModelAngleToleranceRadians)
        for _ in sil:
            if _ is not None:
                crv = _.Curve
                if crv is not None:
                    crv_array = crv.ProjectToBrep.Overloads[Rhino.Geometry.Curve,Rhino.Geometry.Brep,Rhino.Geometry.Vector3d,System.Double](crv, surf,Rhino.Geometry.Vector3d.ZAxis,sc.doc.ModelAbsoluteTolerance)
                    # TODO: https://developer.rhino3d.com/wip/api/RhinoCommon/html/M_Rhino_Geometry_Curve_CreateBooleanRegions.htm
                    # TODO: https://developer.rhino3d.com/api/RhinoCommon/html/Overload_Rhino_Geometry_Curve_CreateBooleanUnion.htm
                    curve_list_1 = []
                    #rs.Command("_CurveBoolean _A _Enter")
                    for c in crv_array:
                    #rs.Command("_CurveBoolean _A _Enter") # THIS FAILS
                #print crv
    print "Boo!"

if __name__ == "__main__":
    ts = time.time()
    print "Elapsed time is {:.2f}".format(time.time()-ts)

example model:

excerpt.7z (1.2 MB)

Hi @ivelin.peychev, some quick notes:

_CurveBoolean fails because of the duplicates and degenerated curves after silhouette i guess. They are caused from all your closed pipe caps which are … duplicates. If i use it like commented out in your above code but remove the duplicates before, _CurveBoolean with _AllRegions works OK. I wonder why you project on a surface instead of a plane ?

Looking at the result, wouldn’t _MeshOutline in top view be the faster way to do this all in one go ? (There is a RhinoCommon equivalent Mesh.GetOutlines(), but you need to pass meshes which is probably fast).


:smiley: I was pissed at Dale’s answer and didn’t look deep enough in the api.

I was thinking about it.
However, since what I’m doing is kind of a proof of concept, I have to ask about the accuracy when converting to mesh.

Hi @clement, this turned out to be the quickest solution. Less code and I didn’t have to script any command. That could probably also work in Rhino6 unlike Rhino.Geometry.Curve.CreateBooleanRegions

Thanks a lot! :beers: :clinking_glasses:

1 Like