Grasshopper

algorithmic modeling for Rhino

Why does there seem to be significantly more VB scripts in GH?

I will start teaching myself scripting for GH soon.

From what I have researched C# and VB use the same libraries and compile to the same machine code. They do the same thing. Aside from a few usability differences that are inconsequential to me, choosing one or the other appears to simply be a matter of a choice in programming style.

I've been active on this forum for a couple of months now. From the cross section of my interests, about 95% of the scripts I've encountered are written in VB rather than C#. My natural choice would be to learn C# because I took some C++ in college and I like the refined style. But I'm a little concerned about learning C# with respect to GH because most of the stuff here is in VB.

Is it just coincidence that Grasshopper users happen to come from other arenas that use VB more? Or, am I missing something that I should know before learning how to script for GH?

Also, once you learn one language well, is it fairly simple to read into and do minor hacking or tweaking in the other, since they are based on the same libraries?

My questions are fairly straight forward. I'm trusting that people in the GH community can keep their cool more than on most forums when a "this versus that" question is asked. Thanks for your understanding.

Views: 231

Replies to This Discussion

Hi Gabe,

 

1) yes, they are basically the same language under the hood. You can very easily convert VB code to C# and vice versa using a plethora of free online tools.

 

2) I suspect VB is more popular because a lot of people come from RhinoScript. Also, I think VB is easier to learn if you have no prior history in programming.

 

3) I wouldn't worry about which language you choose. As I mentioned, it's easy to convert from one language to another.

 

4) Yes, I do believe it is much easier to learn C# if you already know VB and vice versa. There are some pretty hefty differences in syntax, but the framework methods and classes are the same.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Ohh, RhinoScript is based on VB. That's the obvious link I was missing. That is significant; and knowing it could possibly sway me to VB despite my C familiarity. Which leads me to my next question:

Does Grasshopper basically supercede the need for RhinoScript, or do RhinoScript and GH still answer very different design problems? Or, do some of the plethora of C# to VB translation tools provide for a reasonable work-flow if one wanted to write an occasional RhinoScript from C#?

 

(I would likely just be scripting to answer the custom needs of my own particular design problems and not be focusing on applications for public consumption -- if that helps define my scope for programming.)

Grasshopper doesn't supercede RhinoScipt. VB.NET might. Steve has been busy porting a lot of RhinoScript functions to the RhinoCommon SDK and also to Python, which makes it a lot easier to accomplish certain things with an SDK language.

 

Grasshopper doesn't really concern itself with the Rhino document, so anything like selection or layer management, user data and so on would be difficult to accomplish.

 

If you're going to learn a language for Rhino automation and you already have a grasp of OOP, then I'd suggest VB, C# or IronPython. All of these three will eventually work on Rhino, Grasshopper, Windows and Mac. RhinoScript will never work on Mac and it will never work on Grasshopper.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

That's a great set of guidance, replete with nice insight on the future of scripting for Rhino and it's plug-ins.

Thanks

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service