algorithmic modeling for Rhino


I think one of the key strengths and fun parts of Grasshopper is its rich user interface. This can be easily customized by the end-user, leading to bespoke setups. I am interested in starting to create GUI widgets, for example knobs/dials (similar to Max). Even though it may not be super pragmatic, i think it could be a fun task. Are there any suggestions in what directions to take in this regard? (should i look at sub-classing specific components?)

A further question: how can I do something like this:

I would like the group display of the toggle to switch to red when it is false and green when it is true. Also is there a way to 'bind' the toggles, so that the state of one toggle automatically triggers the 'partner' toggle to change?


Views: 3022

Replies to This Discussion

Hi Jason,

it is possible to create your own objects like sliders and toggles. Basically, sliders are just Number parameters with custom attributes. Toggles are boolean parameters with custom attributes. There's quite a lot of work involved in making these as you have to perform layout and drawing all by yourself. Are you looking to do this in VB or C#?

It is also possible to draw pixels into the canvas at various layers. There are 13 events raised over the course of a Canvas redraw and you can draw additional shapes in 11 of them (the PaintBegin and PaintEnd are too early and too late respectively)

  1. CanvasPaintBegin
  2. CanvasPaintBackground
  3. CanvasPrePaintGroups
  4. CanvasPostPaintGroups
  5. CanvasPrePaintWires
  6. CanvasPostPaintWires
  7. CanvasPrePaintObjects
  8. CanvasPostPaintObjects
  9. CanvasPrePaintOverlay
  10. CanvasPostPaintOverlay
  11. CanvasPrePaintWidgets
  12. CanvasPostPaintWidgets
  13. CanvasPaintEnd

Things like your Red and Green circles could be drawn in PrePaintGroups.

Ultimately, it is possible to synch objects, though probably quite difficult if you didn't write those objects. You may have to watch for GH_Document.SolutionStart events and perform your synching there, but I would hate to have to write this code if I couldn't add functionality to the objects to be synched.


David Rutten

Poprad, Slovakia

Hi David, thanks for the swift reply. I will probably write in C# and will try and explore using the suggestions given. Another question I have - is it possible to create custom components in iron python and will the process be much different from the usual C#/ route?

I attached some C# source that defines a magic square object. It has code for custom layout, tooltips, display and mouse handling. It's a fairly typical yet minimal re-implementation of GH_Param<T>


David Rutten

Poprad, Slovakia


Hi David, very cool, thanks.

Hi David, 

First of all, congratulations on the great work, as always, and sorry for replying such an old post.

Seeing this widget you built (very cool btw), made me remind of an old wish of mine! I always suffered a little "debugging" my definitions with more complex data trees with the "panel" component. 

Because i'm used to work a lot with spreadsheet, whenever possible i make grasshopper data go/come from a spreadsheet, so i can have good visualization on my inputs/outputs. On the hand this is never very smooth, so for quicker needs is kind of painful.

I've attached an image of something i think might be worth developing, something like a 2D Panel component, which you could scroll up and down, left and right. Do you think this is doable? Could be either for inputs or outputs.

(Forget about the "NameA", "NameB", etc...)

As always, thanks,


Hi David and apologies for reviving a long dead post!

I was looking to create a multi-value input (like a keyboard, with 26 keys where I could turn them on or off) and using toggles creates a huge mess (I need several of these "input keyboards"). The magic square that you are showing above looks amazing!

If I could click several of the buttons at once and have the numbers as a list output, it is exactly what I need. 

Unfortunately, I downloaded the .cs file but have absolutely no idea what to do with it (I work with Python and can tinker a bit with C# that someone else has written, but that is just about it)

Thank you as always!






  • Add Photos
  • View All

© 2021   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service