Grasshopper

algorithmic modeling for Rhino

Is there anyone who has experience in using the PythonEditor to run a grasshopper file. 
I'm trying to generate information in grasshopper and once the first loop is done, change the values in the sliders and run the same process again. 
Unfortunately you can not backloop in grasshopper so i was told to use the PythonEditor.
But i can't find any examples of how to combine this with grasshopper. 


Thanks. 

Tijl

Views: 3295

Replies to This Discussion

Hi Tijl,

 

I've added the code necessary to measure the line (it's pretty simple once you know where to look: in the RhinoCommon SDK, inside Rhino.Geometry - see here in this case) and modify the slider.

Basically, this script is using both the Grasshopper SDK and RhinoCommon, so the difficult part is in knowing what is in which SDK.

Did you know you can use help(obj), print(type(obj)) and print(dir(obj)) to inspect objects at runtime? If their type start with GH_, then it's sure they are exposed by Grasshopper.dll. They are mostry either UI elements or wrappers for RhinoCommon geometry. I've added a couple more suggestions in the script.

I hope it helps,

 

- Giulio

_______________

giulio@mcneel.com

McNeel Europe, Barcelona

Attachments:

Hi Giulio, 

 

thanks for the useful tips once again!

The only thing i'm still struggling with is that i can't find how to rebuild the solution after a slider change. if been going through the SDK file and the help(slider).

If i change the value of the slider in a loop, it doesn't show this in the grashopper file, or rhino output. Do you know how to acces the rebuildsolution button or a different way to solve this?

 

Thanks, 

Tijl

Hi Tijl,

 

doc.NewSolution(True)

will recompute everything (might be more expensive than just recomputing objects downstream).

 

- Giulio

_____________

giulio@mcneel.com

McNeel Europe, Barcelona

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