| McNeel Wiki | |||||
| edit · print · help · all topics | |||||
Main Pages
Languages
| QuestionI 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. AnswerThe 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 | |||||