Sc.sticky has a limit of 100 items

Hello
I am writing an Agent based script to replicate human evacuation in a building. For writing the script I have to use sticky dictionary to record the previous location of the agents (human) as they ascend towards the evacuation door. I just realised that sc.sticky does not allow me to take more than 100 agents. If I input the value more than 100 it throws an error of index out of range.
Is there a work around?


Isn’t that happening because the first time you initialized it to a size of 100, and because it is sticky you run it again with 101 you will get an out-of-range exception, as it finds the previous dictionary of size 100?

Try to restart Rhino and use 101 immediately.

Hi Menno

Thank you for reverting to my question. The above is just an example of how when I enter 101 items the sticky dictionary doesn’t work. Both the images are just individual examples and not sequential.

I did a quick test here which does not seem to support your finding… I ran the following scriptlet:

import Rhino
import scriptcontext as sc

for i in range(201):
    sc.sticky["TestMaxItems_{}".format(i)] = "item_{}".format(i)
    
print sc.sticky["TestMaxItems_200"]

This prints item_200

To test storing other than strings I also ran this:

import Rhino
import scriptcontext as sc

for i in range(201):
    sc.sticky["TestMaxItems_{}".format(i)] = [0,i]
    
print sc.sticky["TestMaxItems_200"]

which prints [0,200]

Testing several intermediate values also worked, so it appears that I have stored 200 items. I did not test more than that. I also quickly tested it in GH Python, seems to work there as well.

StickyTest.gh (8.1 KB)