Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developer:rhinoscriptsyntax [2015/09/14] (current)
Line 1: Line 1:
 +=====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:
 +
 +  * [[http://​www.rhino3d.com/​5/​ironpython/​index.html|rhinoscriptsyntax reference]]
 +
 +Let's compare scripts for letting a user pick two points and adding a line to Rhino.
 +
 +**RhinoScript Version**
 +<code vb>
 +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
 +</​code>​
 +
 +**Python version**
 +<code python>
 +import rhinoscriptsyntax as rs
 +
 +start = rs.GetPoint("​Start of line")
 +if start:
 +  end = rs.GetPoint("​End of line")
 +  if end: rs.AddLine(start,​end)
 +</​code>​
 +
 +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 =====
 +{{topic>​rhinopython}}
  
developer/rhinoscriptsyntax.txt ยท Last modified: 2015/09/14 (external edit)