Grasshopper

algorithmic modeling for Rhino

Guide to creating custom grasshopper 0.6.X components

People might find this useful.  Please do let me know if you find any errors or omissions.

Best regards,

Ben Sitler

Note: on 2/4 at 13:00 I updated the manual to reflect the discussion on where to locate components on the Grasshopper ribbon.

Views: 19322

Attachments:

Replies to This Discussion

Whoa!

I think you just opened a GH custom component floodgate (I can hear the rushing water bearing down...).

Really cool.
I think Taz has a point.

Would it be prudent to agree to a TabName that Custom components are stored in. That way if anyone uses everyone else's components there is some kind of logic and order to it.

Something like Plug-Ins or Add-Ins or even simply Custom
I started 'Extra' to put Kangaroo in. Still plenty of space over there!
I'm following suit for Geometry Gym tools with 'Extra' unless agreement is reached on something else.

Great work Ben, a very useful guide. I'm up and running with this now, and it works very well. I got referencing my Rhino plug-in dll working, which should get rid of some of the localized installation path issues (dependent on Windows version and language) users were seeing with the c# components. For some reason the symbols aren't loading for the grasshopper dll in my multi-project solution, so I can't debug into it but most of my code is in my dll so fingers crossed it's not really needed.

Thanks again,

Jon
Well, I'm ready to release the first public beta of my GH plug-in, barring one of my components error which I can't seem to resolve.

The input is a list of OnGeometry (may be points, curves or breps), but I get an error about creating an Abstract Class when trying to retrieve a GH_GeometricGoo list.

Here's a sample of the code:
List restraints = new List();

if (DA.GetDataList(1, restraints))

It seems to be this 2nd line that is causing the problem.

Also, what is the best way to create a list of OnGeometry from a list of GH_GeometricGoo ?

Do I iterate through the list and CastTo OnGeometry (or a derived type) and add to a new list of type OnGeometry?

Thanks in advance for any assistance,

Jon
Some further testing shows the code works fine if it is curves being read in.
It only seems to give an error if it is a point being read. I'm not sure if there is a work around?
Oh I see the problem, you're getting GH_GeometricGoo, which is an abstract utility class. Kernel.Types.Point is so weird that it doesn't inherit from GH_GeometricGoo. You should use the interface IGH_GeometricGoo instead, that is the only guaranteed implementation.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thanks for your help David. That got it working.
Have just uploaded the installer so will put it through it's paces now.

Cheers,

Jon
Are you defining a non-generic List? It should be:

List<IGH_GeometricGoo> restraints = new List<IGH_GeometricGoo>();


There is no short cut way to go from IGH_GeometricGoo to OnGeometry. Either you perform all the casts yourself (which is a lot of work) or you look around Grasshopper.Kernel.GH_Convert for useful functions (my recommendation, since those functions will be updated once new data types become available)

--
David Rutten
david@mcneel.com
Poprad, Slovakia
To continue with more stupid analogies, a free-for-all is the nature of the open source beast...

When I installed WeaverBird it took me a little while to find it because it was added to the existing Mesh panel (the opposite problem).

Unless Emperor David makes a decree, I don't know if there can be any real consensus.

But maybe David can allow users to customize panel layouts? It may not have been high on the To-Do list but maybe the priority is now a bit more urgent...
Decree's don't work. If someone adds a single component that clearly belongs in the Curve.Primitive section, I think they should add it to that panel. If someone writes a suite of over 50 components, it probably warrants its own tab.

I specifically designed the Grasshopper SDK so that new tools could be merged into the application as though they are part of the core product.

I think making the UI customizable is the best way to go, but I'm not starting with that anytime soon. First RhinoCommon, then Clusters, then RCP.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
With regards to custom components, does anyone have a sense whether they are more stable or execute more quickly than say a VB or C# component within GH?

I can see the advantages of having custom components so you don't have to copy and paste VB/C# components between files and the code stays up to date but are there any specific speed/stability advantages?

Thanks.

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service