McNeel Wiki
배치 렌더링 (Batch Render)
편집 · 인쇄 · 도움말 · 모든 항목
메뉴

AccuRender

Bongo

Brazil r/s

Flamingo

Penguin

Rhino 블로그

Rhino

Rhino Labs

검색

언어

Česky

Deutsch

English

Español

Français

Italiano

Polish

日本語

한국어

中文(繁體)

中文(简体)

 
.
DeveloperRhinoScript
VersionRhino 4.0
Summary모든 Rhino 파일을 한 폴더에 렌더링하는 방법을 소개합니다.

질문

렌더링을 해야 하는 파일이 여러 개 있습니다. 여러 번의 렌더링 작업을 자동적으로 실행하는 스크립트를 알려 주세요.

답변

다음의 RhinoScript 는 선택된 폴더에 각각의 Rhino 모델을 열고 렌더링 작업을 재귀적으로 실행합니다.

  Option Explicit


  ' Run the subroutine
  Call BatchRender


  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  ' BatchRender
  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  Sub BatchRender()


    ' Allow the user to interactively pick a folder
    Dim sFolder
    sFolder = Rhino.BrowseForFolder(, "Select folder to process", "Batch Render" )
    If VarType( sFolder ) <> vbString Then Exit Sub


    ' Create a file system object
    Dim oFSO
    Set oFSO = CreateObject( "Scripting.FileSystemObject" ) 


    ' Get a folder object based on the selected folder
    Dim oFolder
    Set oFolder = oFSO.GetFolder( sFolder )


    ' Process the folder
    RecurseFolder oFolder


    ' Open an empty model
    Rhino.Command "_-New _None", 0


    ' Release the objects
    Set oFolder = Nothing
    Set oFSO = Nothing




  End Sub


  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  ' RecurseFolder
  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  Sub RecurseFolder( oFolder )


    ' Process each file in the folder
    Dim oFile
    For Each oFile In oFolder.Files
      ProcessFile oFile.Path
    Next


    ' Remark out the following lines if you do not want
    ' to recursively process the folder


    ' Process each subfolder in this folder
    Dim oSubFolder
    For Each oSubFolder In oFolder.SubFolders
      RecurseFolder( oSubFolder )
    Next


  End Sub 


  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  ' ProcessFile
  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  Sub ProcessFile( sFile )


    ' Once we have gotten here, we have a valid file name.
    ' In this case, we are interested in just 3DM files.


    Dim sBitmap
    If (InStr(LCase(sFile), ".3dm") > 0) Then
      sBitmap = Replace(sFile, ".3dm", ".jpg", 1, -1, 1)
      Rhino.DocumentModified False
      Rhino.Command "_-Open " & Chr(34) & sFile & Chr(34), 0
      Rhino.Command "_-Render", 0
      Rhino.Command "_-SaveRenderWindowAs " & Chr(34) & sBitmap & Chr(34), 0
      Rhino.Command "_-CloseRenderWindow", 0
      Rhino.DocumentModified False
    End If  


  End Sub
이름 바꾸기 · 변경 · 히스토리 · 구독 · 찾기 · 참조 · 파일 업로드