Export the print screen image from python step by step


#1

does anyone know python code that could export the printscreen image in python process show the step by step of python that could be used for animation.


#2

You could just script the -ViewCaptureToFile command with rs.Command in a loop. Something like the following which will make n number of frames of moving an object along a curve:

import rhinoscriptsyntax as rs

obj=rs.GetObject("Pick object to move")
crv=rs.GetObject("Pick path curve to follow",4)
folder=rs.BrowseForFolder(message="Choose folder for images")
frames=rs.GetInteger("Number of frames?")

#view size
vWidth=800 ; vHeight=600

#command option string
opts=" _Width="+str(vWidth)+" _Height="+str(vHeight)+" _Scale=1 _DrawGrid=_No "
opts+="_DrawWorldAxes=_No _DrawCPlaneAxes=_No _TransparentBackground=_No _Enter"

pts=rs.DivideCurve(crv,frames,create_points=False,return_points=True)
rs.HideObject(crv) #to not show path curve in image
for i in range(frames):
    rs.MoveObject(obj,pts[i+1]-pts[i])
    rs.Command("-_ViewCaptureToFile "+folder+"\\FrameNumber_"+str(i)+".jpg"+opts)
rs.ShowObject(crv)

–Mitch