rvb Save Animation Frames

rvb animation snippet example

This snippet will show you how to automate frame recording with rhinoscript. We used this as part of the script for the parametric kinetic wall design. It is particullarly suitable for users who do not use Bongo, and would like to create animations. Also, you can try to turn this piece of code into a class for even easier reuse. Do not hesitate to contact us for further information on its possible uses.

Option Explicit

'Script written by Adolfo Nadal

'Script by archiologics · www.archiologics.com

Call Main()

Sub Main()

' Do the geometry changing here

End Sub

Function AnimationSetup()

Dim FileFormat

FileFormat = Rhino.ListBox(Array("JPEG", "Bitmap", "Targa", "TIFF", "PCX", "Pong"), "Select a fileformat to use", "Render queue manager")

If IsNull(FileFormat) Then Exit Function

Select Case UCase(FileFormat)

Case "JPEG":FileFormat = ".jpeg"

Case "TARGA":FileFormat = ".tga"

Case "TIFF":FileFormat = ".tiff"

Case "PCX":FileFormat = ".pcx"

Case "PONG":FileFormat = ".png"

Case Else:FileFormat = ".bmp"

End Select

Dim strFolderPath

strFolderPath = Rhino.BrowseForFolder(,"Select a folder to save to", "Animation Manager")

If IsNull(strFolderPath) Then Exit Function

If msgBox("Are you sure all settings are correct?" & vbNewLine & "Render engine, resolution, quality...",vbYesNo Or vbQuestion, "Render queue manager") = vbNo Then Exit Function

AnimationSetup = array(strFolderPath,FileFormat)

End Function 

Function Render (frameNr, arrOpts, totalFrames)

Dim strFolderPath : strFolderPath = arrOpts(0)

Dim FileFormat : FileFormat = arrOpts(1)

Rhino.Command "-_Render", vbFalse

Rhino.Command "-_SaveRenderWindowAs " & Chr(34) & strFolderPath & frameNr & FileFormat & Chr(34), vbFalse

Rhino.Command "-_CloseRenderWindow", vbFalse

Rhino.Print "... Rendering frame " & frameNr & " out of " & totalFrames

Render = frameNr

End Function



Search Site

archi·o·logics survey

I am interested in: