RhinoScript – Introduction

rhinotutes

GO BACK TO CODESHARE PAGE

RESOURCES

  • David Ruttens Rhinoscript 101
  • Monkey Script Editor
  • INTRODUCTION
    Learning how to script is actually quite straight forward, it just requires patience, persistence and rigor when you first start. Patience in the sense that in the beginning everything will seem daunting, complex and ridiculously foreign. Persistence in that you will want to throw in the towel over and over again. And finally rigor, as it it only through being overly rigorous with how you name your variables, check their data types, print their returns, and so on, that you will you crack the logical hurdle that is scripting.

    CAMEL CASE
    This rather silly term refers to the way we express words in programming languages. Most languages are white space and case sensitive. thus we write like this:
    iWannaLearnHowToScript
    The case step is a logical way of expressing the beginning of a new word whilst eliminating white space.

    ACCESSING RHINO METHODS
    Monkey is a script editor that is specially conceived for rhino. It is a free plug-in and provides excellent documentation on almost all of Rhinos in-built functions.
    All rhino methods are access via the prefix “rhino.”

    For example:

        rhino."INSERT METHOD NAME HERE"
        rhino.print(string message)
        rhino.addPoint(parameters)

    HELLO WORLD!
    With that in mind, we can now write our first rhinoscript. whilst we could simply execute the following in our Monkey editor:

    rhino.print "Hello World!"

    we shall instead introduce our first variable, and formulate the following code:

    -INPUT-

    Dim strMessage 'declare a variable
    strMessage = "Hello World!"          'assign the variable a string value
    rhino.print strMessage

    -RESULT-
    Hello World!

    Do not worry so much at this stage as to the ins and outs of variables, that will be the basis of our next tutorial.

    GO BACK TO CODESHARE PAGE


    About this entry