Wish new Python function AddRailRevSrf like VbScript

Hi Steve
Can you add a new rhinoscriptsyntax function rs.AddRailRevSrf(…) ?
Ciao Vittorio

Added to the wish list.

http://mcneel.myjetbrains.com/youtrack/issue/RH-28814

Thanks Dale
Vittorio

I should add that you can use RhinoCommon to create a rail-revolved surface. Just use Use Rhino.Geometry.NurbsSurface.CreateRailRevolvedSurface.

– D

Hi Dale,
I tried using Rhino.Geometry.NurbsSurface.CreateRailRevolvedSurface but got nothing and nowhere. As for AddSweep1 …the same result.
Do remember that I am trying to get the script to do the complete action with no user
input.
rhinopythonnovice

“”"
When using CreateRailRevolvedSurface get following error message:
"expected Curve, got Guid"
The first two are curves, the third is a line and the fourth boolean?

Parameters required by CreateRailRevolvedSurface
profile: Profile curve for revolution.
| rail: Rail curve for revolution.
| axis: Axis of revolution.
| scaleHeight: If true, surface will be locally scaled.
| Returns: A NurbsSurface or null on failure.

When using AddSweep1 get error message “iteration over non-sequence of type Guid”
"""

import rhinoscriptsyntax as rs
import math
import Rhino.Geometry.NurbsSurface as rgns
import System

#SetViewport?
Length = 20.0
Radius = 3.0
Pitch = 2.0
Turns = 10.0

StartPt = rs.AddPoint(0,0,0)
EndPt = rs.AddPoint(Length,0,0)
RadiusPt= rs.AddPoint(0,Radius,0)

SweepAxis = (StartPt,EndPt)
FullHelixLn=rs.AddLine((0,0,0), EndPt)

plane = (0,3,0)
Outline = rs.AddCircle(plane,0.25)
plane = rs.WorldXYPlane()
plane = (0,0,0)

rs.CurrentLayer( “Layer 04”)
Helix_Path = rs.AddSpiral(StartPt,EndPt,Pitch,Turns,Radius,Radius)
rs.CurrentLayer( “Layer 01”)

Surface1 = rgns.CreateRailRevolvedSurface(Outline,Helix_Path,FullHelixLn,scaleHeight=False)
#Surface2 = rs.AddSweep1(Helix_Path,Outline,closed=True)

How about this:

import rhinoscriptsyntax as rs
import Rhino
import scriptcontext as sc

plane_xy = rs.WorldXYPlane()
circle_id = rs.AddCircle(plane_xy, 5.0)
plane_zx = rs.WorldZXPlane()
arc_id = rs.AddArc(plane_zx, 5.0, 90.0)

circle = rs.coercecurve(circle_id)
arc = rs.coercecurve(arc_id)

line = Rhino.Geometry.Line(Rhino.Geometry.Point3d(0,0,0), Rhino.Geometry.Point3d(0,0,5))
surface = Rhino.Geometry.NurbsSurface.CreateRailRevolvedSurface(arc, circle, line, 5.0)

sc.doc.Objects.AddSurface(surface)
sc.doc.Views.Redraw()
1 Like

Thanks Dale, for a good example of how to integrate RhinoScript with RhinoCommon!

I’m just wondering, is the Redraw() statement at the end really needed?
And, in this case, does it do something different from rs.Redraw()?

It’s the same (redraws all Rhino views). rs.Redraw calls the upper sc.doc.Views.Redraw method. So you can use either of these two.

Because the surface is added by RhinoCommon and not rhinoscriptsyntax, yes…