Grasshopper

algorithmic modeling for Rhino

Hi!

I am trying to write script which can automate to change parameter in slider and export image file.

When I run the following script, it stop to work.

I guess it could go into infinite loop, but don't know how to confirm and fix it.

Can anyone tell me what is problem and how I can solve?

import rhinoscriptsyntax as rs
import Rhino
import System

#Load Grasshopper Plugin as gh
gh = Rhino.RhinoApp.GetPlugInObject("Grasshopper")

rs.EnableRedraw(True)

#get parameter from slider
for i in range(1,2,1):
#Month Slider
gh.SetSliderValue("2fc274ad-b223-4412-9dfa-583846b25f69",i)
gh.SetSliderValue("8e52eafc-2b3d-49ac-9980-8f3776042ca6",i)
for j in range(1,2,1):
#Rotation Slider
gh.SetSliderValue("bf6c1195-a839-460c-b891-b41b1befb20c",j)
gh.SetSliderValue("6d0830a4-fe91-4b1f-9e95-e2e784fe480a",j)
for k in range(8,10,1):
#NumberOfSides Slider
gh.SetSliderValue("62ae003c-1fa8-4254-bdde-7a2e1ad9a0c7",k)
gh.SetSliderValue("1136a5e9-202b-43e5-8c19-d1f117a924c7",k+1)


gh.RunSolver("160816Light shelf_grid_automate.gh")
#baked = gh.BakeDataInObject("72628cf1-020e-425d-9746-6f323f8882f8")

#convert to string and add filename
strNum = str(i)+str(j)+str(k)

doc=Rhino.RhinoDoc.ActiveDoc
view=doc.Views.Find('Pers',False)
doc.Views.ActiveView=view
width = view.ActiveViewport.Bounds.Width
height = view.ActiveViewport.Bounds.Height
bitmap = view.CaptureToBitmap(System.Drawing.Size(width, height))
image=System.Drawing.Bitmap(bitmap)

image.Save(strNum+".jpg")

Views: 404

Replies to This Discussion

Hi Marcus,

Thank you for your reply.

I know that Animate function in slider component can do that.

But I want to change multiple slider for many cases.

Thus I thought that using Animate function will be tedious.

If you have further advice, I appreciate it.

Thank you!

Katsuya 

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