Grasshopper

algorithmic modeling for Rhino

Hi!

I know it possible to set a slider in Grasshopper from a Python script (see below, gh.SetSliderValue(" ")), but is it possible to get the output value of the Grasshopper script back to Python?

Regards,

Stijn

import rhinoscriptsyntax
import Rhino

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

#SetSliderValue("GUID",Number)

gh.SetSliderValue("c70bd93b-749b-42d2-aee2-bb5e97cf473d",5)

Views: 990

Replies to This Discussion

Hi Stijn,

When you say Python, you mean: RhinoPython editor?
If that is so, then at the end of your ghpython component, you can send the output to sticky dictionary:

a = "someValue"

sc.sticky["ghpython_component2_output"] = a

Then in RhinoPython editor, you can read the value you assigned to the mentioned key:

try:
    a = sc.sticky["ghpython_component2_output"]
except:
    print "no value has been assigned to \"ghpython_component2_output\" key"

Hi djordje,

Thanks for your reaction, but i'm not sure we are talking about the same thing.

I am not using a ghpython component in Grasshopper, but i loaded the Grasshopper Plugin into RhinoPython editor. 

In the link below they manage to automate the sliders, but now I want to load the result from Grasshopper back to RhinoPython. 

http://www.designalyze.com/course/automate-grasshopper-python

As far as I have seen at the link below, there's no such method available through Grasshopper RhinoScript. BakeDataInObject could be used to bake the geometry, but anything other than geometry would not be able to be baked.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service