rvb Batch render - make2d

rvb batch render tool

This tool will help you save time by allowing you to batch reder and make 2d. Select your operation, output folder, extension type, and go to sleep... let your computer do the work!

Option explicit

'Script written by Adolfo Nadal

'Script by archiologics · www.archiologics.com

 

Call BatchRenderMake2d()

Sub BatchRenderMake2d()

Dim pathFolder, curView

 

Dim strResult, arrOptions(3), arrObjects

Dim FileName, blnRender 

pathFolder = Rhino.GetSettings(Rhino.InstallFolder & "archiologics_batch.ini", "BatchRM2D", "Folder")

 

If IsNull(pathFolder) Then pathFolder = Rhino.BrowseForFolder(,"Pick a destination folder", "Output Folder")

If IsNull(pathFolder) Then Exit Sub

 

Do

arrOptions(0) = "Folder"

arrOptions(1) = "Render"

arrOptions(2) = "Make2d"

arrOptions(3) = "Quit"

 

strResult = Rhino.GetString("Options",,arrOptions)

 

If IsNull(strResult) Then strResult = "Quit"

Select Case strResult

Case "Make2d"

blnRender = False

Exit Do

Case "Folder"

strResult = Rhino.BrowseForFolder(pathFolder,"Pick a new destination folder", "Output Folder")

If Not IsNull(strResult) Then pathFolder = strResult

Case "Render"

blnRender=True

Exit Do

Case "Quit"

Exit Sub

End Select

Loop

Rhino.SaveSettings Rhino.InstallFolder & "archiologics_batch.ini", "BatchRM2D", "Folder", CStr(pathFolder)

Dim arrResults, arrItems, arrDefaults,strShow,strHidden,strMaintain,strFormat

 

If blnRender Then 

arrItems = Array(".png",".jpg",".tiff",".bmp")

strFormat = Rhino.ComboListBox(arrItems,"Select render extension type","Render output")

If IsNull(strFormat) Then strFormat = ".png" 

Else 

arrItems = Array("ShowTangentEdges","No","Yes","CreateHiddenLines","No","Yes","MaintainSourceLayers","No","Yes","ExportFormat","ai","3dm")

arrDefaults = Array(True,True,True,False)

arrObjects = Rhino.GetObjects("Select objects to make 2d drawings of",,True,True,True)

arrResults  = Rhino.GetBoolean("Make2d settings", arrItems, arrDefaults)

 

If arrResults(0) Then strShow="Yes" Else strShow="No"

If arrResults(1) Then strHidden="Yes" Else strHidden="No"

If arrResults(2) Then strMaintain="Yes" Else strMaintain="No"

If arrResults(3) Then strFormat=".3dm" Else strFormat=".ai"

End If

 

Dim arrViews, strView

arrViews = Rhino.NamedViews

If IsArray(arrViews) Then

Dim currView

currView = Rhino.CurrentView()

 

Call Rhino.EnableRedraw(False)

For Each strView In arrViews

If  blnRender Then

FileName = Chr(34) & pathFolder & strView & strFormat & Chr(34)

Rhino.RestoreNamedView(strView)

Rhino.Command "-_Render "

Rhino.Command "-_SaveRenderWindowAs " & FileName & " _Enter" 

Rhino.Command "-_CloseRenderWindow "

Else

FileName = Chr(34) & pathFolder & strView & strFormat & Chr(34)

Rhino.Print(strView)

Rhino.RestoreNamedView(strView)

Rhino.SelectObjects(arrObjects)

Rhino.Command "-_Make2d DrawingLayout=CurrentView ShowTangentEdges=" & strShow & " CreateHiddenLines=" & strHidden & " MaintainSourceLayers="& strMaintain & " Enter",0 

Rhino.Command "_SelNone",0

Rhino.Command "_SelLast",0

Rhino.CurrentView ("Top")

Rhino.Command "_Zoom Selected"

curView = Rhino.CurrentView

If Rhino.IsViewPerspective(curView) Then

Rhino.Command "-_Export"& FileName, vbFalse

Else

Rhino.Command "-_Export " & FileName & " _PreserveUnits=No _Enter", vbFalse

End If

Rhino.Command "_Delete ",0

Rhino.CurrentView (strView)

Rhino.Command "_SelNone",0

End If

Next

Call Rhino.EnableRedraw(True)

Rhino.RestoreNamedView currView

End If

 

Rhino.Print "Finished"

End Sub

Search Site




archi·o·logics survey

I am interested in: