Question on different compilers

script
compiler
components

#1

OK, so if I understood this correctly there are two compilers -

  • one compiler (here) for Grasshopper script components (exclusively Rh6) and
  • one compiler (here) for regular non-Grasshopper scripts (Rh5 >=)

Q: Can both compilers compile both VB and Python scripts?



Anyway, while at it I’d like to ask another question regarding the script languages.

I may have missed some trick, but I experience RhinoScript (VB) as not having the same “deep level” access to the underlaying Rhino core functionality as the PythonScript, and further yet, not as deep access as the two script components (lets call them GhVB & GhPython) in Grasshopper.

For example, plain PythonScript seems to have the “import” option which gives “deeper access” than VBScript, which leads to my final question: Is there a way to do something like “import” also for VBScript as to give it deeper access?

For a newbie it’s a little bit confusing with all the variants, although it’s of course of great value that they exist. It just takes some clarifications what limitations the different approaches actually have (causing some “false leads” when being more ambitious than knowledgeable in Rhino development…).

If someone could describe the most important differences (in capability), their respective pros and cons, that would be gold for Rhino newbies like me. :slight_smile:

Add to it that I’m not fluent in C# and .NET (I’m only vaguely aware of some .NET concepts, but entirely lost on the overall structure of it).

// Rolf


Tutorial: creating a Grasshopper component with the Python GHPY compiler
(Giulio Piacentino) #2

Hi Rolf @RIL

I just split the topic so that this can be more easily found and the other topic does not deviate from its original purpose.
On question 1 part 1,

Yes, that’s correct, although earlier there was yet another version of the Plug-in “compiler”, for version 4 and 5, which would bring the count of compilers to 3.

Technically, the Plug-in compiler is a packager. It packages Vb Scripts, and Python scripts, into a .Net plug-in. The source code may be hidden, but is not translated into another programming language or instruction set.
These plug-ins are Rhino plug-ins, and do not create Grasshopper components. Its scope is the Rhino command line.

The GhPython compiler is meant to compile Python scripting components into native components. Its scope is the Grasshopper canvas.

I think you are noticing the difference between Vb.Net and VbScript. These are two different programming/scripting languages. They are semantically similar, but differ in library content.

“Import” is what gives access to .Net Framework type names in a Vb.Net file. That is not available in VbScript.

In general,

  • RhinoCommon ( a library to allow communication with Rhino ) is available in all .Net development environments (GhVb, GhC#, GhPython, RhinoCommon Plug-ins written in C# and Vb.Net).

  • VbScript gives access to the RhinoScript library. That is a C++ library for VbScript only.

  • Python is a mixed breed. It has full access to RhinoCommon thanks to the flavor that we chose, IronPython. And there is a RhinoScript-like library, accessed using import rhinoscriptsyntax, that mimics the simple nature of RhinoScript and gives access to Rhino in a procedural way.

This implies that the Vb.Net scriping component in Grasshopper has no VbScript, and so RhinoScript is not available there, but only the Object-Oriented RhinoCommon.

You may like the Rhino Developer homepage. There is more information there regarding these topics.

I hope this gives some quick starting points,
Thanks,

Giulio

Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


#3

Absolutely crystal clear answers. Thank you very much.

Also the tutorial on GHPY compiler was something special - crystal clear and easy to follow. That tutorial can in turn be a tutorial for helpfiles for presenting concepts in Rhino in general. I’m serious.

Again, thanks, this was very helpful.

// Rolf


(Giulio Piacentino) #4

Thank you, too, Rolf.