AddPipe in Python with Rhino Common


#1

Hi Steve and All
Can you post an example of AddPipe with Rhino Common in Python?
Ciao Vittorio


#2

Hey Vittorio,
The following is not 100% RhinoCommon, and it’s only a simple example with start/end radii (no intermediate radii)… but FWIW:

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino

tol=sc.doc.ModelAbsoluteTolerance
aTol=sc.doc.ModelAngleToleranceRadians

crvID=rs.GetObject("Pick a curve to pipe",4)
crv=rs.coercecurve(crvID)
sRad=rs.GetReal("Pipe start radius")
eRad=rs.GetReal("Pipe end radius")
pipes=Rhino.Geometry.Brep.CreatePipe(crv,(0.0,1.0),(sRad,eRad),True,0,False,tol,aTol)
for pipe in pipes:    
    sc.doc.Objects.AddBrep(pipe)
sc.doc.Views.Redraw()

I can put up an example of one with intermediate radii later…
–Mitch

edit: hmm, the python-specific formatting doesn’t seem to be working, showed up in the preview, then it disappeared. and now it’s back… bizarre.


#3

Hi Mitch
Thank you very much, is what I want.
Ciao Vittorio