Feature Request: Debugging-Component "LED"

Hi all,

I’d like to make a feature request for a simple debugging component, maybe there is someone out there who could make this. It could be useful for many GH programmers.

The component I’d like to have shall be just a simple on/off display, being green if the input value is “true” and being red if the input value is “false”. Just like a small LED which is soldered to a large circuit board.

Currently I’m using a small snippet that I built from a panel and MetaHopper components. Here is how it looks like:

It does its job, but I’d prefer a single-component solution for tidiness.

Important to me is, that I can scale the panel to any size I want so that it is large enough to recognize its color even if the canvas is fully zoomed out.

Maybe this can be done with a panel using two inputs (text/bool)? Maybe there is already a single-component-solution? Any help appreciated.

Cheers, Henry

1 Like

2020-02-25 01_35_21-Window
You can do something with a bunch of rows in c#.

Code: (it needs a “using System.Drawing;” on top)

  private void RunScript(Color C, ref object P)
  {
    Grasshopper.Kernel.Special.GH_Panel panel;
    panel = (Grasshopper.Kernel.Special.GH_Panel) this.Component.Params.Output[0].Recipients[0];
    panel.Properties.Colour = C;
    P = " ";
  }

panel_color.gh (12.7 KB)

You can make even blinking ones, if in need.


Gif color compression gone bad :\

Edit:
You can edit the script so it accepts integers as input and then internally the color is decided by a couple of IFs:

  private void RunScript(int x, ref object P)
  {
    System.Drawing.Color C;
    if(x==0) C = System.Drawing.Color.Red;
    if(x==1) C = System.Drawing.Color.Lime;

    Grasshopper.Kernel.Special.GH_Panel panel;
    panel = (Grasshopper.Kernel.Special.GH_Panel) this.Component.Params.Output[0].Recipients[0];
    panel.Properties.Colour = C;
    P = " ";
  }
1 Like