Grasshopper

algorithmic modeling for Rhino

Hi,

I am trying capture screen from grasshopper using C# component. It somehow works but it is not perfect...

I want to ask how can I set path where to save file? 

And right now code behave little bit weird. When I press button it capture screen to file but grasshopper is somehow stucked and I cant edit definition or move with components. I have to press button again and capture the screen.. 

How can I solve this problem?

this is my code: 

string myDef = "-ViewCaptureToFile " + name + ".jpg" + " Scale=2 _Enter";


if(capture == true){

RhinoApp.RunScript(myDef, true);

}

 

Thanks for replies!

MBE

Views: 1362

Attachments:

Replies to This Discussion

Not sure, the attached script works for me. You didn't specify a folder for the image, maybe that was the problem?

You also didn't surround the filename with double-quotes, that may also give problems with the Rhino command line as spaces are interpreted as ENTER presses.

Attachments:

Thanks for reply David. I have tried to put path "C:\Users\BednarM\Desktop\MyPictere.jpg" instead of your string file but it does work to me (attached capture_to_file_old.gh defition). 

Path definition is already working but I have still problem - when I press the button it saves the picture but then grasshopper is not working = I cant move canvas or move with components. I have to press the button again. It saves next picture and grasshopper starts to work properly...

I am using grasshopper 0.9.0076. I have tried it on another computer with grasshopper 0.9.0070 and it was same problem.

Thanks!

Attachments:

I think it's a bug in the Button object. The click happens very fast, but it takes a long time to deal with the first click (saving an image to disc takes several milliseconds) and it somehow never registers the mouse button release. So Grasshopper keeps waiting for the mouse button to go back up over the button, even though that has already happened.

I think your best option now is to use a Toggle instead of a Button.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service