[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.

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.