Grasshopper tools in C#
Grasshopper features an impressive amount of highly interlinked components – from lines to trees, from circles to graph editors. Sometimes, however, when design tasks become more advanced, we might need to further customize this plugin by directly borrowing from Rhino commands. With these scripting components, the user can quickly solve otherwise more complex design behaviours.
This list of C# scripts is a work in progress and is open for requests. Supporting v. 0.6.0043.
| baking & Referencing | ||
![]() |
bakeName GH 0.6.0012 GH 0.6.0018 GH 0.6.0043 |
obj (geom) – a list of objects to bake name (string) – a list of names (common Rhino property) activate (bool) – one go-no-go signal, or a list thereof A (strings) – a list explaining the result(s) |
![]() |
bakeAttributes GH 0.6.0012 GH 0.6.0018 GH 0.6.0043 |
obj (geom) – a list of objects to bake name (string) – a list of names layer (string) – Rhino layer name(s) color (onColor) – screen+print color(s) lineT (string) – the name of a linetype. Please only use with custom names. pWidth (double) – printing thickness(es) wires (int) – number(s) setting the quantity of wires, as in the property panel material (int) – GH shader(s), containing a Rhino material activate (bool) – one go-no-go signal, or a list thereof A (strings) – a list explaining the result(s) |
| findID findRef GH 0.6.0012 2009 06 19 |
x (geom) – a Rhino geometry
A (string) – The Rhino ID |
|
| Automatic Sections | ||
![]() ![]() |
contours GH 0.6.0012 GH 0.6.0043 2009 06 04 |
input (geom) – the objects to contour axis (onLine) – a line identifying the origin and end of the sectioning axis dist (double) – the interval between sections geomOut (geom) – a list containing all geometries meshOut (geom) – a list containing all geometries deriving from a mesh |
| Continous redrawing | ||
![]() ![]() |
theEngine
component for 2009 06 06 |
isOn (bool) – one go-no-go signal speed (int) – a period, expressed in milliseconds, that sets the refreshing rate resetAt (int) – the last shown number in the series, which will be restarting at 0stopAt (int) – the last shown number in the series starting at 0 reset (object) – any object (or bool) passed here will make this component restart from 0 C (int) – the current count |
![]() ![]() ![]() |
Buckets
GH 0.6.0012 |
x (list) – a list of points. For the bucket, it can be a list of anything. reset (object) – any object here will make this an empty list limit (OnInterval) – two numbers which set the max and min values for each internal point coordinate A (list) – the list in memory |
![]() |
renderAnimation
GH 0.6.0012 (four examples, see last one) |
geometry (list) – a list of objects to be added to the scene before rendering viewport (string) – the name of the viewport to use. If empty or non-existing, the active one will be used filePath (string) – a name of an existing folder. If empty, the folder of the open document will be used. If document not saved, the current user’s document folder will be used fileExt (string) – jpg, png, bmp, or another extension that the rendering engine supports current (int) – the sequential number of the frame A (string) – a text, explaining the outcome |
| fonts | ||
![]() |
txtLines GH 0.6.0012 2009 06 04 |
face (string) – the name of the font bold (bool, default false) italics (bool, default false) size (double, default 5.0) content (string) – the text shown pt (on3dPoint) – the point ancoring the text A (OnLine list) – a list containing all curves |
| Networking | ||
![]() |
updReceiver udpSender GH 0.6.0019 Processing 1.0.5 + UDP library 2009 08 31 |
port (integer) – a resonable port number
out (string list) – network echo |













May 28th, 2009 at 11:38 pm
Great definition. I had a question about the Color attribute. I had wanted to turn on that attribute for the autobake toggle… but how is the color syntax formatted? Is it something like this?
att.m_color = new OnColor(255,255,255)
where the three numbers are RGB values? Or would you include a hexidecimal value? Or is there I’m completely missing. Other than that, this definition works great. Congratulations.
May 29th, 2009 at 11:11 am
Hey Andy, glad you like it. The new “advanced” definition should now do what you asked for.
June 7th, 2009 at 5:57 pm
Amazing job! These are some great tools. Thanks for all of the hard work.
June 9th, 2009 at 1:56 am
Giulio,
Great stuff. We had Andy over here at the lab in the weekend and he pointed us in your direction. Your code blocks will be excellent starting points for the research on multi disciplinary optimization and topology we are doing.
Thanks & I’ll be sure to keep you up to date with feedback.
June 13th, 2009 at 9:12 pm
Great work on theEngine components, love ‘em!
take care,
d.
July 14th, 2009 at 2:01 am
Nice work, they are very useful! Thank you very much!
P
July 19th, 2009 at 9:34 pm
hey G
these are great. to get a still instead of an animation would that be easy to get using your animation component?
regards
July 22nd, 2009 at 7:32 pm
[...] component to continuously refresh the GH canvas. You can find that component at his site:http://www.giuliopiacentino.com/grasshopper-tools/. The processing sketch was hacked together from a simple processing animation found at [...]
July 24th, 2009 at 9:47 pm
[...] the fluid as a Surface. As with the rest of the UDP experiments, Giulio Piacentino’s “The Engine” component made the refreshing of the Grasshopper canvas [...]
July 29th, 2009 at 9:37 am
Hey Giulio, great job!
Greetings from Bologna!
Best,
Alessio
July 29th, 2009 at 12:25 pm
Hi,
I am really interested with your script and trying to utilize it.
But I am having a problem with inputing your script to my C# tool.
What I am doing is just copy & paste your script into the portion named “your code”.
Could you let me know what’s wrong with it?
July 30th, 2009 at 11:28 am
There is no need to copy-and-paste, all you need to do is download the .ghx file (in some older browsers right-click the component and select “Save target as…”) and open it in Grasshopper. Should work with GH 0.6.12
August 3rd, 2009 at 12:00 pm
Hi Giulio,
similar basic question as Wansoo’s. I’ve tried opening or merging bakeAttributes. But an IO always pops up with 46 messages, mainly components failed to deserialize. Any hints on using this C# component will be helpful. Ta.
August 3rd, 2009 at 3:18 pm
Hi Andrew, there will be soon an update with hotfixes for GH 0.6.0018. That release changed some inner workings in GH, so files are now not 100% compatible with version 0.6.0012. There’s nothing to worry about, everything on this page will be compatible, or with two releases. I’m glad if anybody can help in this task.
August 20th, 2009 at 12:59 am
Hello !
Great job indeed ! Trying to use theEngine but I’m having the following error :
The type or namespace name ‘EH_SolutionCause’ does not exist in the namespace ‘Grasshopper.Kernel’ (are you missing an assembly reference?)
Even if I do not have an error with the theEngine using stopAt, nothing happens.
GH version 0.6.0018 – Rhino 4SR5 (do I need 4SR6?)
thanks !!!
August 20th, 2009 at 11:39 am
The latest compatibility release should now work!
September 2nd, 2009 at 7:02 pm
great job guilio, unfortunately i have only used the contour command… will be able to explore others in the next few weeks….
September 15th, 2009 at 4:17 pm
thanks for the C scripts, they are very very helpful …. i am using the bake attributes script, using version 06.0012
i don’t understand how the delete materials boolean works … do i need to make clusters of my objects first before baking? where does this component connect to?
many thanks
September 16th, 2009 at 5:30 pm
[...] http://www.giuliopiacentino.com/grasshopper-tools/ [...]
September 18th, 2009 at 8:39 pm
Hi Mei, glad to help. The “delete materials” is only intended for advanced use (if you are using really many materials). Unselect all objects in Rhino, then use the boolean command once. Save your 3dm model, close it and reopen it in Rhino. You document should not contain any material now!
September 24th, 2009 at 1:50 am
HI Giulio,
Your site is great, thanks for all the sharing. I have been trying to add the “renderAnimation” component into my grasshopper definition, but did not manage to render the animation. Basically, I want animate two walls where the sun would move over the course of a day. The hours are controlled by a slider. My question is how do I tell Rhino to render, is there a switch created by the component?
Thanks
September 25th, 2009 at 10:54 pm
many thanks giulio, will try it out …
January 30th, 2010 at 4:11 pm
great post – helpful for my grasshopper