Snapshot output

(Gustavo Fontana) #21

hi Guys, I’m buried in GH deadlines, still working on that, I’ll check what Pascal send me tomorrow am and I’ll report back. Thanks!


(Nathan 'jesterKing' Letwory) #22

Here is my script:

# script to capture all snapshots in a file to PNG files.
# assumes all captures are going to be at the one
# asked for resolution.
# will overwrite existing PNG files without asking questions.
# Nathan 'jesterKing' Letwory, 2019.04.16

import scriptcontext as sc
import rhinoscriptsyntax as rs
import Rhino as r
import System

def capture_viewport(path, name, width, height):
	av = sc.doc.Views.ActiveView
	view_capture = r.Display.ViewCapture()
	view_capture.Width = width
	view_capture.Height = height
	view_capture.ScaleScreenItems = False
	view_capture.DrawAxes = False
	view_capture.DrawGrid = False
	view_capture.DrawGridAxes = False
	view_capture.TransparentBackground = False
	view_capture.RealtimeRenderPasses = 10
	bitmap = view_capture.CaptureToBitmap(av)
	if bitmap:
		filename = System.IO.Path.Combine(path, name+".png")
		print "saving ", filename
		bitmap.Save(filename, System.Drawing.Imaging.ImageFormat.Png)

width = rs.GetInteger(message="Width for capture")
height = rs.GetInteger(message="Height for capture")
folder = rs.BrowseForFolder(folder=System.Environment.SpecialFolder.Desktop, message="Select folder to save snapshot captures to", title="Select folder to save snapshot captures to")
if None in (folder, width, height):
	print "aborted capturing all snapshots"
	path = folder
	snappies = [n for n in sc.doc.Snapshots.Names]
	for snappy in snappies:
		r.RhinoApp.RunScript("-_SnapShots _Restore \"" + snappy + "\" _Enter _Enter", False)
		capture_viewport(path, snappy, width, height) (1.6 KB)

Remember to disable animation of restore for fastest capture process.

(Gustavo Fontana) #23

hi @pascal, @nathanletwory,

Just finished work but I had to try these. They both work great!

also Pascal’s script is attached: (3.8 KB)

Here’s is a dummy file with 3 snapshots for anyone to try it.
export_all_snapshots_viewcaptures_byname_gf_190414.3dm (3.8 MB)

Here’s the documenation:
Run ! _-RunPythonScript “F:\assets\rhino\scripts\” for Pascal’s version (or whatever path you saved your script)

! _-RunPythonScript “F:\assets\rhino\scripts\” for Nathan’s version (or whatever path you saved your script)

Thanks so much!


Please make it possible to export snapshots in Rhino6
(Nathan 'jesterKing' Letwory) #24

looks like the script from @pascal is a bit nicer in that it retains settings for the duration of a Rhino session. And scripted transparency control.