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 :)).
- Can I change the persistent data in the external file?
- 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 valuelist.SelectItem(PulldownIndex.Branch(i)) valuelist.ExpireSolution(True) i += 1 if __name__ == '__main__': # Open Grasshopper File fp = FilePath fp = fp.replace("\\","/") io = Grasshopper.Kernel.GH_DocumentIO() io.Open(fp) doc = io.Document doc.Enabled = True #Convert Dropdown lists if PulldownNames is not None: Dropdown(doc) for obj1 in doc.Objects: if obj1.NickName != "Output": # Skip if the component is not the Output Breps continue if obj1 != None: # Ouput Breps Output = obj1.PersistentData obj1.ExpireSolution(False) obj1.OnObjectChanged(GH_ObjectEventType.PersistentData) Output = Output
I hope anyone could help me out! Thanks in advance.