Please add to the Python wishlist

I could use an UnlockAllObjects method. Currently, the unlock methods require objects id’s, but sometimes I need to unlock everything in the file. I have one scenario where I lock everything that isn’t a cylinder or a planar surface. When the task is done, I use the regular Rhino command “Unlock” to unlock everything, It seems to me a Python method would be handy.

Secondly, I could really use a method for sorting cylinders that are complete, not just portions. In our business we deal with a lot of holes, and a IsCylinderClosed method would be VERY useful. I don’t need to know if the ends are capped, just that the cylindrical surface forms a true cylinder. Currently, the IsCylinder method also finds fillets.

Of course, if any of this is currently possible and I’m not seeing it, I welcome suggestions.



Hi Dan,
How about:


As to the cylinder question, I can’t really answer that one, except to find all closed objects first with IsObjectSolid() and then check for IsCylinder() among the results…

Edit: rereading your question, I see that will not work for what you want… sorry


Yes, that works. Thanks for pointing out what should have been obvious to me.


Hi Dan,

I’m guessing that only straight-edged fillets are getting found by IsCylinder() - otherwise there is something wrong…

rs.IsCylinder() is just calling Rhinocommon Rhino.Geometry.Surface.IsCylinder. Technically straight fillets are cylinder parts and IsCylinder doesn’t tell you what portion of a cylinder the chosen object might represent. What you might be able to do first isolate possible candidates with IsCylinder(), shrink the surfaces, then determine the U,V degrees of those surfaces with SurfaceDegree - for any “cylindrical” object they should be 1 and 2 - then check with rs.IsSurfaceClosed() in the degree 2 direction… Closed in the degree 2 direction should mean a full tube section…

Dunno, just an idea off the top of my head…


Yes, you are correct, it’s straight fillets that are getting selected along with the cylinders. I will try your suggestion and see how it works out.

Thanks again,


Hi Dan, maybe you could use

bln, cylinder = yoursurface.TryGetCylinder()

to test for a closed cylinder. The bln variable does seem to return false on fillets.


Hi Clement,

What is your source for TryGetCylinder? Is this RhinoCommon? Is there a resource I can look at that will expose methods like this?



Here is the RhinoCommon SDK…

It’s also in the Python editor:

However, it’s pretty arcane if you don’t know what you’re looking for, it’s not like the rhinoscriptsyntax help.

Also look at the Python/RhinoCommon samples in the Wiki

HTH, --Mitch

Hi Mitch and Dan, i´ve used the chm help and searched for “cylinder” then TryGetCylinder was appearing near the top in the list :smiley:


Wow!! I wish I was a programmer! This would probably not give me as bad of a headache. :smile:

Thanks for the tips. I see I have a long way to go!


it´d be great to be able to use




One way to find out if a surface or brep is unrollable is to unroll it. :smile:

If it does not get a result, it cannot be unrolled. This example here shows how to unroll and if it worked, it creates the unrolled geometry. You could remove this part from the example, which creates the unrolled geometry:

for brep in breps: scriptcontext.doc.Objects.AddBrep(brep)
    for curve in curves: scriptcontext.doc.Objects.AddCurve(curve)
    for point in points: scriptcontext.doc.Objects.AddPoint(point)
    for dot in dots: scriptcontext.doc.Objects.AddTextDot(dot)

to create a function like IsSurfaceUnrollable.


Hi @clement

Could you give me an example of how you used TryGetCylinder() to test for a closed cylinder? This subject has come up again for me. I need to separate cylindrical fillets from holes.



Hi Dan,

this might be one way to distinguish between closed cylinders and fillets (which are cylindric but not closed):

import rhinoscriptsyntax as rs

def SubSelectCylinder():
    obj_ref = rs.GetObject(message="Sel", filter=8, preselect=False, subobjects=True)
    if obj_ref:
        if subsrf:
            # check if part of cylinder
            res, cyl = subsrf.TryGetCylinder()
            if res:
                # check if cylinder is closed in u or v direction
                if subsrf.IsClosed(0) or subsrf.IsClosed(1):
                    circle = cyl.CircleAt(0.0)
                    print "Closed cylinder properties:"
                    print "axis vector:", cyl.Axis
                    print "center:", cyl.Center
                    print "height:", cyl.TotalHeight
                    print "diameter:", circle.Diameter
                    print "this cylinder is not closed"
                print "sorry, i am not a cylinder"

if __name__=="__main__":


Thank you for this. I will study this in the morning.

Take care,