[Python] Add Curve Piping Render Property to curves


I need to add the Curve Piping Render Property to a series of curves (in Python). I have searched the RhinoCommon API docs, examples, and here on the forum without any success. Perhaps the render attribute version it’s not called “piping” under the hood. (Just to clarify, I am not looking for rhinoscriptsyntax.AddPipe())

Can any developers or users with experience in this area point me in the right direction?


I guess curve piping in Rhino uses Mesh.CreateFromCurvePipe.

1 Like

Hi, thank you, but unfortunately that is not it.

I am looking for the call to add render time Curve Piping. It’s an attribute/property that is added to the curve object. In the rhino GUI, it’s exposed under the “Properties” panel, “Curve Piping” tab.

I’m not sure if it’s even possible to control these properties from Python but you can create meshes and use display conduit to display your curves as pipe:

from scriptcontext import doc
import System
import Rhino

class DrawMeshConduit(Rhino.Display.DisplayConduit):
    def __init__(self, mesh):
        self.mesh = mesh
        self.color = System.Drawing.Color.White
        self.material = Rhino.Display.DisplayMaterial()
        self.material.Diffuse = self.color
        if mesh != None and mesh.IsValid:
            self.bbox = mesh.GetBoundingBox(True)

    def CalculateBoundingBox(self, calculateBoundingBoxEventArgs):

    def PreDrawObjects(self, drawEventArgs):
        gvp = drawEventArgs.Display.Viewport
        if gvp.DisplayMode.EnglishName.ToLower() == "wireframe":
            drawEventArgs.Display.DrawMeshShaded(self.mesh, self.material)

circle = Rhino.Geometry.Circle(20)
m = Rhino.Geometry.Mesh.CreateFromCurvePipe(circle.ToNurbsCurve(), 0.5, 20, 50, Rhino.Geometry.MeshPipeCapStyle.None, False)
conduit = DrawMeshConduit(m)
conduit.Enabled = True

CurvePipe.py (1.0 KB)

I’ve just found out that we can check whether CurvePiping is activated or not for a curve object by checking RhinoObject.Description. And also fount out how we can get the pipingmesh and add it to document. The CurvePiping option seems to store as UserData so Obviously, we can add another curve object with the same attributes and if we purge the UserData from a curve object, the CurvePiping option would be deactivated:

import Rhino
import rhinoscriptsyntax as rs
from scriptcontext import doc

id = rs.GetCurveObject("Select a curve with curve-piping")[0]
obj = doc.ActiveDoc.Objects.FindId(id)

log =  Rhino.FileIO.TextLog()
print log

#add piping mesh to document
renders = obj.GetRenderPrimitiveList(Rhino.DocObjects.ViewportInfo(doc.ActiveDoc.Views.ActiveView.ActiveViewport), None)
if renders is not None:

#add a circle with same attributes
circle = Rhino.Geometry.Circle(20)
doc.Objects.AddCircle(circle, obj.Attributes)

#remove curve-piping

CurvePiping.py (679 Bytes)

I couldn’t manage to find out how we create attributes from scratch with proper UserData to activate curvepiping.

Hi @Dow and @Mahdiyar,

you might just script the _-Properties command and access the options via CommandLine:

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs

def DoSomething():
    crv_ids = rs.GetObjects("Curves", 4, True, True, True)
    if not crv_ids: return
    cmd = "_-Properties _CurvePiping _On=_Yes _Radius=2 _EnterEnd"
    rs.Command(cmd, False)



Mahdiyar, Clement,

Thanks to you both for your helpful suggestions. I will dig into them further on Monday.

Does anyone know who the developer of this area might be, so I might ping them and see if there’s a pythonic way to set these properties?

This should be @andy


Hi @Dow,

I’ve requested a sample from the developer.


– Dale

Unfortunately there is no other way than scripting. I will add it to the pile.

Hi @andy

Thank you. I am still using my workaround. Having a way to do this with python would be welcome.

Has anyone been lucky to get this to work? I need to select blocks and set piping inside blocks onto curves.

I found out this could be easily done with macros BUT it is not possible to exit block edit mode with macro?! is there anyway i can edit blocks and run applycurvepiping command automatically? from macro, pythton or c# i dont mind. i need to know if its possible. @pascal

Hi Ivan - I do not see a way so far…


it is a pity. too often i hit a deadend to seemingly easy things :frowning:

CapType= Flat

This is the best we can get. Beware there is a bug in captype propery you need to set _SPACE Flat otherwise it does not work so there is unneccessary space in that property.


I’m trying to add more options to you script and most of them are working, with the exception of the CapType. It seems that by default curves are assigned to have a ‘dome’ cap and this isn’t be overwritten by this script. @ivan.galik noted this above.

Any help would be appreciated.


cmd = '_-Properties _CurvePiping _On=_Yes _Radius='+ radius +' _Segments=8 _CapType=F _Enter _Accuracy=0 _EnterEnd'

Hi @lignindes,

Here is a sample script that sets the curve piping parameters for selected curves. Maybe you can find some use for it.

test_curve_piping.py (3.9 KB)

– Dale

1 Like


It’s absolutely beautiful.

Thank you.


Hi @lignindes, i’m a bit late to the party but if you change:


with this (use space as recommended by @ivan.galik insteady of the equal sign):

_CapType Flat

it should work. Depending on the language you may add an underscore before the option value…