C# Documentation

Hi,

Trying to get started with grasshopper and scripting using C#. There is not a lot out there for this topic. The documentation provided by rhino seems useless, referring to the grasshopper SDK and others. They describe the component but not its parameters. How is someone meant to know how and what to impute in to the component to make it work? Any advice on this matter. This all came to be as I was trying to create simple geometry but due to the lack of information was unable to extrude a circle.

I’m not sure exactly what you’re looking for, but here are a some suggestions:

  • Google “Rhino grasshopper tutorials” and you’ll find lots of tutorials to get you started

  • If you right click on a component there is a help item that will give you some information about the component inputs.

  • If you want to write a C# script, you need to setup you input and outputs, then edit the script (you’ll probably need the Rhinocommon API reference to do any geometry manipulations)

Hope this helps,

Joh

This might be a good place to start?

Hi,

Thanks for the reply. They question is purely about grasshopper C#. Which there is a lack of information for. The API information is useless, as mentioned before. How can you extrude a line with C#?

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Surface_CreateExtrusion.htm

The api provides the methods. If you don’t know how to use them then that is just because you don’t know C#, nothing to do with Rhino. I suggest to start here: https://mva.microsoft.com/en-us/training-courses/c-fundamentals-for-absolute-beginners-16169?l=Lvld4EQIC_2706218949

2 Likes

Have in mind that in real-life doing geometry is nothing. Managing the whole thing is everything.

Other than that see attached.

Extrude_EntryLevel_V1.gh (118.6 KB)

1 Like

What I did not know in the beginning is the fact that you do Rhinocommon.
Grasshopper is simplified seen “just” the visual editor around Rhinocommon. When writing GH-C# scripts you hardly access Grasshopper.dll. So everything you need to know is C# and the Rhinocommon api, just as the others said.

With this information you will notice the documentation is very detailed. Rhino has one of the best documentation of an api out there. Furthermore there are tons of examples in this forum and on google. However if you don’t know much about C#, this doesn’t help. Thanks to reflection and as a consequence with intellisense, you don’t even need an api anymore. Thats one of the biggest advantages of C#.

I’d recommend starting with the C# Scripting and Plugin Development video series found here: https://developer.rhino3d.com/videos/

Hi, it all seems just somewhat confusing… The documentation I presume is to provide all the relative information regarding grasshopper’s native commands. I have tried going through the rhino common API as suggested by Michael Pryor as well as going through the Grasshopper SDK. I have been looking for all native commands in these directories, but some just don’t show up e.g. Move command. Any guidance?

When you google rhinocommon move
https://developer.rhino3d.com/samples/rhinocommon/move-points/ is the first search result and answers your question about move

These are made by David (and some maybe by his assistants). AFAIK there’s no explicit info available and of course no source: for instance the 3 Populate components and numerous others.

For exposed to public Methods: use Rhino and GH SDK (Software Development Kit),

https://developer.rhino3d.com/api/RhinoCommon/html/N_Rhino.htm

https://developer.rhino3d.com/wip/api/grasshopper/html/723c01da-9986-4db2-8f53-6f3a7494df75.htm

In some R SDK Methods (for instance: Intersection.CurveCurve Method etc) there’s code examples available that may (or may not) be useful.

In general: if GH is only a part of the arsenal of the apps that your practice uses … try to write code as GH neutral as possible. For instance DataTrees is a custom GH data organization schema … meaning that attempting to port code managing data that way into other apps may require major changes.

if you don’t read what people write to you, nobody can help you. There is no Grasshopper native command. Its a piece of code made out of Rhinocommon commands, which sometimes has a less technical term for beginners. So the move component does a “translation”, which is the right technical term for this.

1 Like