Grasshopper

algorithmic modeling for Rhino

Hello all, 

I've been trying to implement an event handler for a method I implemented within a C# scripting component. What I'm looking for is to check whether a solution has finished, I believe the SolutionEnd event is the proper event to use.

How could I implement such an event system? Are there any simple examples of event handling implementations within the scripting component? (or the SDK, I suppose that the same general rules hold for both).

Thanks.

Views: 600

Replies to This Discussion

Hi Yiannis,

there is one example here:

http://www.grasshopper3d.com/forum/topics/timers-and-theengine-scri...

- Giulio
_____________
giulio@mcneel.com
McNeel Europe, Barcelona
Giulio, thank you very much, this is exactly what I needed.
Hi Yiannis,

if you want to check whether or not a solution has finished at a random time, you can query the SolutionState property on the Document.

If it's PreProcess, then a solution is not running, but the current state of the document does not reflect "the right answer". In other words, something has just happened that has expired a bunch of objects and a new solution is imminent.
If it's Process, then a solution is currently running.
If it's PostProcess, then a solution has completed and the document is in a valid state.

If you want to respond to a solution coming to an end, then you should use the SolutionEnd event.

--
David Rutten
david@mcneel.com
Seattle, WA

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service