algorithmic modeling for Rhino
Dear all, dear David
I have been searching but could not get my hands on a way to add figures above the canvas form like what happens when the solving is disabled:
I would like to achieve something quite similar (a thick border + an icon, when something dangerous is happening...), so I suppose it would be the same method than the one used for the disabled solver, but I have no idea where to begin.
So, thanks in advance if somebody has a clue...
Thibault.
Tags:
Well, it can be done, though not in the exact same way as the Disabled Solver graphics. The canvas draws stuff in distinct layers (or "channels") and there are events for each channel that you can handle and draw custom stuff.
These are all the events that are generated given a typical Canvas painting procedure:
As you can see quite a few events. I hope the names are self-documenting enough for you to guess what sort of painting goes on in between these events.
You'll want to draw your stuff way at the end so that it doesn't end up underneath any other objects. You can handle CanvasPostPaintWidgets for this (CanvasPaintEnd is too late to start drawing stuff).
Another approach would be to create a custom Widget. The downside of this one is that other widgets (compass, markov chain etc.) may be drawn on top of you. The upside though is that you get to handle mouse events so when someone clicks on your border or icon you can 'eat' the click.
Do you need further example code?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
I implemented the CanvasPostPaintWidgets event approach in the attached file.
--
David Rutten
david@mcneel.com
Tirol, Austria
Wow
That was fast!
It's exactly what I needed, huge thanks, this is a great example!
Have a nice evening!
Thibault.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by