I have found the following C code. While it works one thing I need to modify somehow is to prevent the wire of the list to be disconnected once updated. Now when I connect the list to the code, it updates and it disconnects. How can I modify this?
AutoValueList_EDIT.gh (4.9 KB)
Try using Human plugin and it’s not like a dictionary with key/value pairs but it allows you to select the items (values) in a similar manner.
I know, but I need this to be connected to a cluster. Human does not work well inside a cluster for some reason.
1 Like
nope… I have to modify the above C component to just stay connected to the list. Trouble is I am totally code illiterate…
1 Like
Now I get it .
Would you agree having a button that triggers the update of the value list?
Because currently if you remove from the code the “disconnection” the component enters in an infinite loop and crashes Rhino.
If you have a button then this “ExpireIt” function will be rather useless and you’ll be updating the values whenever user wishes (like if you push a button).
I’m not sure I can edit this particular code, but I could try making it with python, doing the same thing. (I can read C# code, but it’ll take me ten times more time if I have to write it.)
Hi @davidsmavrov,
See if this helps.
AutoValueList_EDIT.gh (10.8 KB)
update: (now it checks if it is a value list)
AutoValueList_EDIT.gh (10.8 KB)
1 Like
Hi @piac,
In the above script when I try to check
if type(source) == gh.Kernel.Special.GH_ValueList:
or
if type(source) == type(gh.Kernel.Special.GH_ValueList):
the GhPython component becomes broken.
any idea?
Update:
hmm now it diesn’t break , maybe I broke it with something else.
1 Like
Actually this can do the trick. But for some reason I can´t make it work when it is inside a cluster.
AutoValueList_CLUSTER.gh (12.6 KB)
The reason it doesn’t work inside a cluster is because cluster is “immune” to ExpireSolution() calls.
You can only expire a cluster when you change a value of an input.
If you use the button, it should work.
update:
, OK my bad. It doesn’t work with button either.
I created a suggestion a year or so ago about expiring solution of a cluster.
I think @DavidRutten said it won’t change in GH1
@davidsmavrov, perhaps if you hook up a timer it will work. Bad workaround, I know, but cluster is lazy static.
1 Like
Nope… not even with timer…
1 Like
Yep,
Looking at the bright sight, I learned another way to break GhPython and ValueList components.
1 Like
And I have learned a bit of code. Also learned about the program´s limitations. If they remove the expire solution thing this will allow for a vast array of complex behaviour… Oh well…
1 Like