Site Tools

Revolving Profile Curves

Developer: RhinoScript
Summary: Demonstrates how to create a surface by revolving one or more profile curves using RhinoScript.


I want to use the AddRevSrf method to create a surface by revolving profile curves. But, the method only accepts, as an argument, a single curve. Is there a way to revolve more than one curve at a time and still create just a single surface?


Since the AddRevSrf method only accepts a single curve, you can use the JoinCurves method to join multiple curves into a single curve.

For example:

 Option Explicit
 Sub MyRevolve
   ' Declare local variables
   Dim obj_list, crv_list, crv, axis0, axis1
   ' Select one or more curves to revolve
   obj_list = Rhino.GetObjects("Select curves to revolve", 4, True, True)
   If IsNull(obj_list) Then Exit Sub
   ' Pick start of revolve axis    
   axis0 = Rhino.GetPoint("Start of revolve axis")
   If IsNull(axis0) Then Exit Sub
   ' Pick end of revolve axis    
   axis1 = Rhino.GetPoint("End of revolve axis", axis0)
   If IsNull(axis1) Then Exit Sub
   ' If more than one curve as picked, try to join them
   If (UBound(obj_list) > 0) Then
     crv_list = Rhino.JoinCurves(obj_list, False)
     crv_list = Array(obj_list(0))
   End If
   ' Create the surfaces of revolution  
   For Each crv In crv_list
     Call Rhino.AddRevSrf(crv, Array(axis0, axis1))
   ' Delete the temporary joined curves
   Call Rhino.DeleteObjects(crv_list)
 End Sub

developer/scriptsamples/revolve.txt ยท Last modified: 2020/08/14 (external edit)