McNeel Wiki
Batch Save Small
edit · print · help · all topics
Main Pages

AccuRender

Bongo

Brazil r/s

Developer

Flamingo

Penguin

Rhino Blogs

Rhino

Rhino Labs

Search

Languages

Česky

Deutsch

English

Español

Français

Italiano

Polish

日本語

한국어

中文(繁體)

中文(简体)

 
.
DeveloperRhinoScript
VersionRhino 4.0
SummaryDemonstrates how to recurse through a folder and "save small" every Rhino file.

Question

I have a number of files that I would like to "save small" in order to save disk space. Is there a script that can help automate this? Or, do I just have to open each model one at a time.

Answer

The following RhinoScript will recurse through a selected folder, open each Rhino model and perform as "save small" operation.

  Option Explicit


  Sub BatchSaveSmall()


    Dim sFolder
    sFolder = Rhino.BrowseForFolder(, "Select folder to recurse", "Batch SaveSmall")
    If VarType(sFolder) <> vbString Then Exit Sub


    Dim oFSO
    Set oFSO = CreateObject("Scripting.FileSystemObject") 


    Dim oFolder
    Set oFolder = oFSO.GetFolder(sFolder)


    RecurseSaveSmall oFolder


    Set oFolder = Nothing
    Set oFSO = Nothing


  End Sub


  Sub RecurseSaveSmall( oFolder )


    Dim oFile
    For Each oFile In oFolder.Files
      DoSaveSmall oFile.Path
    Next


    ' If you do not want to recursively search,
    ' just comment out the following lines.
    Dim oSubFolder
    For Each oSubFolder In oFolder.SubFolders
      RecurseSaveSmall( oSubFolder )
    Next


  End Sub 


  Sub DoSaveSmall( sFile )


    If InStr(LCase(sFile), ".3dm") > 0 Then
      Rhino.Command "_-Open " & Chr(34) & sFile & Chr(34)
      Rhino.Command "_-SaveSmall _Enter"
    End If


  End Sub


  ' Run the script automatically
  BatchSaveSmall
rename · changes · history · subscriptions · lost and found · references · file upload