How to turn ghpython components "orange" (if missing inputs)?

Hello,
I’m writing a set of tools in ghpython components (will be distributed as UserObjects). I’d like to imitate the behaviour of standard GH components that turn orange (“Component did not run…”) if not all of the necessary inputs have been plugged in (or Nones have been passed to inputs).

Currently I considered two options:

  1. error-catch everything (then the component stays grey, but this conceals a problem - the user might not notice that the output is Null)
  2. do nothing and let the component fail and turn red (this is also silly because it will be red as default when placed on the canvas).

Is there a way of controlling when to “run” the component in ghpython (either procedural or SDK mode) ?
Or is there another workaround to turn components orange?

Many thanks for any hints :wink:

In procedural mode:

import Grasshopper as gh

w = gh.Kernel.GH_RuntimeMessageLevel.Warning
ghenv.Component.AddRuntimeMessage(w,"I'm a orange warning")
1 Like

Wonderful! Many thanks for the superfast reply!
Have a nice day :wink:

1 Like