Grasshopper

algorithmic modeling for Rhino

How do i update GH slider via python (or other?) in a better way?

I am updating sliders in GH with python, to see changes in "real-time" i use 

gh.RunSolver("filename")

But saving the file every time i want to change a slider seems so wasteful and also it is very slow. 

Are there any other ways of doing this in code or maybe another way? i just want to control GH slider outside GH, i made a python GUI because it made sense with my current skill level. 

Views: 946

Replies to This Discussion

Hi Eivind,

You have been using the (grasshopper) plugin methods:

import Rhino
import time

gh = Rhino.RhinoApp.GetPlugInObject("Grasshopper")

for i in range(3):
    gh.SetSliderValue("slider id", i)
    gh.RunSolver("somefile.gh")
    time.sleep(0.5)

gh.SaveDocument()

?

Yes you can set slider values. You can either use the GH SDK directly, get the GH_Document, find the GH_NumberSlider, set the new value, then trigger a new solution. Or you can use the RhinoScript interface that Grasshopper provides to set these values.

I'm not very good at Python so I don't know if you can access the SDK without referencing it.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service