Grasshopper

generative 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: 301

Reply to This

Replies to This Discussion

Giulio,

 

It has been a while, but back with questions again..

I've been trying to understand your script and adapt it in such a way that i can use it.

At the moment i seem to be able to change a few parameters, but other than lines, curves and circles have been difficult.  No idea how to change a slider or move component yet. (is there any way to find their names or what code to use?)

 

All i try now is to change the length of a line and draw a circle at the end. Once the circle is drawn, i want to measure the radius and if this radius is not the previous radius length it should continue with the loop and add a line.

 

I'll add my grasshopper file and code.

Do you know how i can make this last step??

 

Thanks for your help!

 

Tijl

Attachments:

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

Translate

Search Grasshopper

Photos

  • Add Photos
  • View All

© 2013   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service