Grasshopper

algorithmic modeling for Rhino

A few of my Python scripted components are unable to bake geometry, so I'd like to temporarily put in an error message for when a user tries to bake geometry with them. How would I go about doing it best?

Right now, I am trying the following:

def bakeWarning(e, sender):
    ghenv.Component.AddRuntimeMessage(w, 'This object cannot bake      geometry outputs.')

r.RhinoDoc.AddRhinoObject += bakeWarning

And while it does raise a warning when I try to bake with the component, it does so immediately and at the same time for all other components with this bit of code as well. I'd like to limit raising the warning to only the component which was used to bake. What event would I need to watch for (I'm guessing it's somewhere in ghenv.Component) and how could I limit the warning to just that one component?

To illustrate, if I tried to bake with the component in green, then it would be the only one raising the warning. The current case right now is that when I try to bake using the component in green, the three other components before it also raise a warning:

Any help or tips are much appreciated.

Views: 250

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service