Update sliders, checkboxes etc. in external GH file

Hi everyone,

I want to update a geometry in an external file by changing the input values of dropdowns, sliders, checkboxes, panels etc. This happens in “Properties Editor” in the GUI (figure: orange rectangle).

So far I am able to recognize the input components in the file, and change the values. However, the output geometry (stored in “Output” data component in external file) does not change after we click “commit” (this button works, so that’s not the problem :)).

My question:

  1. Can I change the persistent data in the external file?
  2. Or shouldn’t I use persistent data and retrieve my output?

So far, this is my code:

def Dropdown(doc):
    # Dropdown iteration
    for name in PulldownNames:

        # Iterate through components/objects in GH document
        i = 0
        for obj in doc.Objects:
            if obj.NickName == name:
                # object is de valuelist in dit geval            
                valuelist = obj
                # Select item in dropdown on index G
                i += 1
if __name__ == '__main__':
    # Open Grasshopper File
    fp = FilePath
    fp = fp.replace("\\","/")
    io = Grasshopper.Kernel.GH_DocumentIO()   
    doc = io.Document
    doc.Enabled = True
    #Convert Dropdown lists
    if PulldownNames is not None:
    for obj1 in doc.Objects:
        if obj1.NickName != "Output":  # Skip if the component is not the Output Breps         
        if obj1 != None:
            # Ouput Breps
            Output = obj1.PersistentData
        Output = Output

I hope anyone could help me out! Thanks in advance.

BR, Eveline

Hi Evelin,

I am copying my reply to the PM you sent me.

I do not think that what you are after is part of the codebase that you are showing in the message above. Right now, I do not know what the “PROPERTIES EDITOR” window is, I think maybe a third-party plug-in?, and it does not appear to be something developed by Robert McNeel & Associates. For this reason, I also suggest you may be trying to contact the developer of that framework.



Giulio Piacentino
for Robert McNeel & Associates

Hi Guilio,

Sorry for the unclear message, I think there might be a misunderstanding. The GUI is not in any way part of the problem. Just to visualize that we expect updated geometry, that you can then see with other dimensions in the GUI.

So the problem is in the python script part. The dropdowns don’t get updated in the external gh file while they should.

Could you maybe help me out with how to update the dropdowns?

Thanks in advance.



Again, the dropdown is not part of Grasshopper or of Rhino. As such, I cannot assist with its SDK, the nature of its consistency and working. You should ask or tag here the developer of that framework.

All that is visible is this: PulldownNames. There is no other indication in the script excerpt regarding what that is. It seems that it is developed as part of some third-party plug-in, or another part of the script, but I do not know.

EDIT: In the screenshot, from the appearance, it seems that the dropdown is coming from Human UI. You might get answers here: https://discourse.mcneel.com/c/grasshopper/human-ui

Sorry I used the wrong name for it, I meant a Value list (which is grasshopper original). In the python script above, we try to set the value in another Grasshopper file (see figure below) according to the value given by “PulldownIndex”. The resulting geometry should then be retrieved by the script.

So the question is: How do i retrieve this geometry?

Hoi Eveline - you will need to provide the necessary gh file(s) so that people can see what is actually going on.


external_file.gh (5.3 KB) main_example.gh (6.9 KB)
I made an example just to make it easier for u guys to help, thanks for that.
The file “Main_example” has to retrieve the output of the “external_file”. The Valuelists are changed in the “main_example file” and control the actual Valuelists in the “external_file”.

Hope this cleared things up.


You’re on the right track! Here are a few adjustments:

  • Your external file is missing an “Output” parameter, which the script is looking for
  • you don’t need to check for if __name__ == '__main__': you can just write code you want executed
  • You’re trying to get persistent data - which will be empty in this case. Persistent data is the data in a param when you “internalize” it or set its value explicitly (eg. right click, set one number) — what you want is Volatile data, which is the data calculated/retrieved from other component execution.
  • fp = fp.replace("\\","/") is unnecessary.
  • You don’t need to expire the solution for everything - it suffices to call doc.NewSolution(False) once.
  • something strange is happening in your script that I don’t understand; if you call “SelectItem” on the value list with a value of 1 it seems to be stopping python execution altogether. I am sure there’s a bug in the script but I’m not seeing it.

Here is a revised / simplified version of your script, which seems to be working. I have simplified some of your loops and conditionals into List Comprehensions for conciseness:

import Grasshopper

io = Grasshopper.Kernel.GH_DocumentIO()
ghdoc = io.Document
ghdoc.Enabled = True

for name in valueListNames:
    valueList = [o for o in ghdoc.Objects if o.NickName == name][0]

output = [o for o in ghdoc.Objects if o.NickName == "Output"][0]

Output = output.VolatileData.AllData(True)


Thank you so much!!!

It works perfectly now, furthermore i really love your scripting structure, nice and clean.

Been working on this for a while, this was my first scripting and grasshopper experience.

Thanks for bringing the fun back!

1 Like