Hello, I am a total Rhino newbie trying to understand scripting with python in Rhino… so I hope this is the right place to ask.
I have a quite general question about libraries to use. It is recommended to use functions from “rhinoscriptsyntax” or use the rhino common functions (e.g. imported as “Rhino.Geometry as rg”)? Where are the advantages of rhinoscriptsyntax when I can address all Rhino functions? I am just wondering since sometimes it seems finding functions in Rhino Common is much easier than the equivalent one in rhinoscriptsyntax and I have a feeling not all rhino functions are converted to python functions. But I’m sure I’m missing something here and maybe rhinoscriptsyntax is really much more convenient using python in Rhino.
Thanks a lot in advance! So far coding in Rhino is exciting… but also hard when starting with it.
Rhinoscriptsyntax uses both Rhino Common as well as scriptcontext methods.
If you debug a script you can step into rhino script syntax methods to see which methods are used from Rhino common.
Most of the script syntax methods will end up creating geometry in the Rhino document. Sometimes this is handy, sometimes you don’t want this to happen, but just create geometry in memory to work with.
for example rhinoscriptsyntax.AddCircle() will add a circle to the Rhino doc.
Doing the same with Rhino common code would be something like:
Only the last line will actually draw the geometry in your doc.
The above is just a simplified example, not complete code.
In addition to the great suggestions already mentioned, make sure to take advantage of the left hand tree pane of the Rhino Python Editor. Specifically, the rhinoscriptsyntax tree. When you expand a rhinoscript method, and highlight it, you will, (almost always), get a description of the method and a simplified example.
And, if you double click on a method, (in the left hand tree pane), it will take you to the help documentation!