Best practice for writing GH components that run on R5 and R6?


#1

Been wondering what is the best recommended route for writing GH components for distribution on F4R, want the components to run on R5 and R6. Currently using Python and compiling .ghpy components in R6, but those won’t work in R5. Will R5 have a SR to facilitate GH reading those .ghpy components ?

I have been avoiding writing RhinoCommon since the amount of code to be written is a whole lot compared to Python. For me the easiest transition from VB would be .Net. Please excuse my ignorance as I am a beginner in programming and I lack some important knowledge I guess.

I need a solid way for creating a GH component, and the .ghpy for now seems very troublesome due to the different behaviour of the RS methods in PY and GHPY, also would prefer to write relatively high level.

Is .Net a good start for me, what about future proofing ? What Visual Studio is enough ? 10 would work for R6 ? Can I keep writing in Python and hope that .ghpy will become a solid option for quick writing ? If there is no plan to have R5 use those .ghpy components than I have to move to another method.


(Menno Deij - van Rijswijk) #2

.NET is currently working fine on Grasshopper for Rhino v5. You can work in any Visual Studio that targets .NET 4 or higher (I think that is VS2010 and up; the latest Community Edition of VS2015 is feature packed and free). It is most convenient to install the Grasshopper project templates from https://visualstudiogallery.msdn.microsoft.com/9e389515-0719-47b4-a466-04436b491cd6 and go from there.

Be advised that the long-term goal for Grasshopper is to make it work on Mac as well. This means that Grasshopper will be re-written from the ground up to make it cross-platform (see http://www.grasshopper3d.com/page/grasshopper-for-mac). What this means for compatibility with components that work in the current version of Grasshopper is not known. Maybe @DavidRutten can say something about this.


(David Rutten) #3

They will not work. Firstly the SDK will be completely different and secondly we’re ditching the GHA file format and switching to RHP. That means you can put Rhino commands and Grasshopper components in the same plugin project.


#4

So David, any advice for writing GH comps with futureproofing in mind?


(David Rutten) #5

Nope. Only advice is to write clean code that is easily maintainable/adjustable.


#6

Edit: Never mind - I solved it (problem was due to a “Blend” version of Studio - I had no idea what that was… - which started after install, and so the templates didn’t show like in the real VS. Sigh.)


This thread seems informative, so I hope I can start from here :

I just installed VS 2015 Community, and downloaded the GH Wizard and clicked (GHPackage.vsix) to install. I then tried to insert the code as described in the GrassHopper SDK chm-file, like so:

… but code is inserted (nothing happens) and the compiler doesn’t seem to recognize the GH_Component class. I also can’t find any reference to this class library in the settings dialogs.

Notice, I’m absolute newbie on VS (and .NET too) so I simply don’t know where to look for the cause of problems. Any hints about where to look for the cause of the problem?

Edit:
OK, I just found the GH template in Tools | Extensions and Updates, so it’s obviously installed. Must be a path problem then…

// Rolf