Automate Screenshot of 5 different directions of 1 model?

Hello everyone.

Is there any way of creating a script to make 5 different perspective screen shots. What I mean is, I have 1 model created in grasshopper, then I click screen capture and the script automatically takes a screen shot of the left, right, top, bottom and front view to 5 different .jpg images on desktop.

Just asking because I manually do this all the time, the same shots of my models and it would be cool to do this with a simple script.

Any help would be super cool.
Thank you.
Ian :slight_smile:

First, you should set 5 views in Rhino.Then run C# script in GH.

List < String > strs = new List<String>{"Top","Bottom","Left","Right","Front"};
    for (int i = 0;i < strs.Count;i++)
      var view = doc.Views.Find(strs[i], false);
      var view_capture = new ViewCapture
          //        Width = view.ActiveViewport.Size.Width,
          //        Height = view.ActiveViewport.Size.Height,
          Width = 1600,
          Height = 1200,
          ScaleScreenItems = false,
          DrawAxes = false,
          DrawGrid = false,
          DrawGridAxes = false,
          TransparentBackground = true

      var bitmap = view_capture.CaptureToBitmap(view);
      if (null != bitmap)
        var path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
        var filename = Path.Combine(path, strs[i] + ".Png");
        bitmap.Save(filename, System.Drawing.Imaging.ImageFormat.Png);
    } (2.2 KB)

1 Like

Thank you so much ! Thats a real help :slight_smile:

I hope I can ask one silly question. When I create the saved views in Rhino, I have typed the same names into your code. Im just not sure what buttons I need at the end to activate this and save the 5 .png files to the desktop.

Would you mind showing me how to finish this ?
Thank you.
Ian :slight_smile:

1.Your rhino should be like below image,contain 5 views.

2.if you want to run the C# script again, you can press recomputer or F5.

1 Like

the better solution is to add a boolean input. (5.0 KB)

1 Like