Grasshopper

algorithmic modeling for Rhino

Hi! I'm new on Rhinoceros and Grasshopper, i'm trying to write a script for Rhino, it must change the value of a sliders (grasshopper) and save the file in .3dm. Is possible? 

Views: 1198

Replies to This Discussion

Yes it's posible. You have to make your script, that works by manually changing the parameters. Then you have to iterate over all parameters of the canvas, select the parameters that you want, change their value, and then bake geometry and export them in 3DM. This can be programmed, speaking without going into details.

I write this script and it works well

import Rhino
import time
import rhinoscriptsyntax as rs
import os

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


for i in range(11):
   gh.SetSliderValue("4e69ce31-4cc2-4268-acc7-2e8c2826ec86", i)
   for j in range(11):
      gh.SetSliderValue("c731b0a2-c894-4ed0-9028-0be1cc0a2cb8", j)
      gh.RunSolver("")
      time.sleep(0.5)
      cmd = "_-SaveAs C:\GrasshopperBackup\Anello"+ "r" + str(i) + "a" + str(j) +".3dm"
      rs.Command(cmd, True)

But i must find the InstanceGuid string and i can't take from the slider the max value for optimize the loop. Any advice?

I can not help with python or RhinoScript. In case you did not know, there is a component of ghPython. Perhaps you would be more comfortable working from gh.

http://www.food4rhino.com/project/ghpython?etx


To find the slider there is no to use the id, look here below. It's easy to access the sliders, but I can not help you with python. Search on the forum, there are good material on it (usually in VB or C#)

http://www.grasshopper3d.com/forum/topics/change-number-slider-para...

Thanks for help! Another question, i need to auto-bake after every changes, how i can do this? 

in VB: Dim id As guid = rhino.RhinoDoc.ActiveDoc.Objects.Add(YourGeo)

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