Grasshopper

algorithmic modeling for Rhino

Hi everyone, I hope I can get some quick help on this. Basically I have a loop of numbers that feeds into my python component. I have set up the script to use rs.command to execute the 'screencapturetofile' command. I want a new image to be saved for each time the x input receives a new number. But I just can't seem to figure out how to get the save file command to work properly, or how to iterate on the filename so it doesn't get overwritten each time. Thanks very much for any help. 

if x <10:
filename = str("C:\Users\Andrew\test") + "/" + time + ".jpg"
rs.Command( "_ScreenCaptureToFile", echo=False)
rs.Command("Browse " + filename, echo=False)
rs.Command("enter")

Views: 399

Attachments:

Replies to This Discussion

Hi Andrew, have a look at the file I posted here: http://www.grasshopper3d.com/group/kangaroo/forum/topics/a-simple-t... (apologies for the link, on an iPad)

Hi Anders, thank  you, that does exactly what I was looking for. I imagine this could be applied to the Print to image (ctrl+P) command as well. Just out of curiosity, is there any way to make this work with the rs.command option in the script I was trying to make? Or is that just a dead end?

I'm pretty sure that rs.command() function is just a wrapper around the rc.RhinoApp.RunScript() function. These take a string which define a Rhino command (which means that you could automate all sorts of Rhino specific commands from Grasshopper). So yes, you should be able to interchange the functions, not that it should much of a difference :)

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service