Site Tools


Rhino.Python rhinoscriptsyntax Module

One of the key features of RhinoScript that make it easy to write powerful scripts is a large library of Rhino specific functions that can be called from scripts. Our python implementation includes a set of similar functions that can be imported and used in any python script for Rhino. This set of functions is known as the rhinoscript package. Documentation on this package can be found at:

Let's compare scripts for letting a user pick two points and adding a line to Rhino.

RhinoScript Version

Dim arrStart, arrEnd
arrStart = Rhino.GetPoint("Start of line")
If IsArray(arrStart) Then
  arrEnd = Rhino.GetPoint("End of line")
  If IsArray(arrEnd) Then
    Rhino.AddLine arrStart, arrEnd
  End If
End If

Python version

import rhinoscriptsyntax as rs
 
start = rs.GetPoint("Start of line")
if start:
  end = rs.GetPoint("End of line")
  if end: rs.AddLine(start,end)

Different… but similar enough that you should be able to figure out what is happening in python if you've written RhinoScript.

Samples that use rhinoscriptsyntax

developer/rhinoscriptsyntax.txt · Last modified: 2015/09/14 (external edit)