algorithmic modeling for Rhino
I use it all over the place for Ladybug and Honeybee to share the functions and classes. I don't know if it is "official & suggested way in Grasshopper". I would only make sure to select a unique name for the key not to overwrite what someone else already put there!
Hi Mostapha,
I wrote a small piece of code to undrstand what stickey is. I gather it's a dictionary that containes many of the classes, and a few class objects you created.
I am wondering why am I seeing only keys and values assigned by you. Is it because no other developer is using this method?
Is this dictionary a session specific? What I mean to ask is, is it created eveytime we start grasshopper?
Thanks,
These data are copied to sticky once you let the ladybug or honeybee fly. When you open Grasshopper for the first time it should be an empty dictionary.
Ok. Thanks Mostapha!
Hi Marcus
I would say this is as official as, generally, third-party libraries are. Not everything that is possible should generally be done. In fact, if you can avoid this, I would suggest to do so. There are reasons why this is interesting, though, and other reasons why this should be avoided.
The main reason for this, is a Grasshopper-only way to distribute "libraries". The main disadvantage I see is user confusion. What Mostapha is doing is interesting and has a meaning, but you should not count on the fact that users will always add this "parent" component first, so you should at least find a way to let them know that they need the additional component. Secondly, there is no way in Grasshopper to officially tell "first compute that lonely component", but my understanding is that Grasshopper will probably keep on solving in the order it is solving now.
I hope this helps,
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
What I do is pretty simple. Ladybug_Ladybug component copies all the classes into sticky and then sets "ladybug_release" to True:
https://github.com/mostaphaRoudsari/ladybug/blob/master/src/ladybug...
So I can check this key and make sure ladybug is flying, otherwise I will ask the user to let it fly!
if sc.sticky.has_key('ladybug_release'):
lb_preparation = sc.sticky["ladybug_Preparation"]()else:print "You should first let the Ladybug fly..."w = gh.GH_RuntimeMessageLevel.Warningghenv.Component.AddRuntimeMessage(w, "You should first let the Ladybug fly...")return -1
https://github.com/mostaphaRoudsari/ladybug/blob/master/src/Ladybug...
The order of execution is not really straight forward. Check this discussion: (http://www.grasshopper3d.com/forum/topics/order-of-execution-for-un...). I assume there should be a solution to the ctrl+B from the code inside the component.
Hi Mathias,
this is an old topic. Yes, now it looks like this is the case.
Thanks,
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
If there are no connections at all, then the solve order equals the draw order. However as soon as there's a connection between two elements, the receiving one will ensure that the providing one is solved first. So if you have a file with three objects (in draw order) {A, B, C} and none of them are connected, then the solve order will be {A, B, C}.
If both B and C are connected to the outputs of A, then the solve order will still be {A, B, C}.
If A is connected to the output of C, then the solve order will be {A{C}, B}, where A is initially asked to solve itself, but from within its own solution code it first triggers C.
If I were you I wouldn't rely on the order of things being in a specific way, not only is the above behaviour not a guarantee we make, it is already possible to develop custom components that subvert the default order.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson.
Powered by