SketchUpのRubyStartupオプション
SketchUp起動時にRubyスクリプトを実行させることができる。↓こんな感じ。
D:\>"c:\Program Files (x86)\Google\Google SketchUp 8\SketchUp.exe" -RubyStartup "d:\test.rb"
- スクリプトファイルは絶対パスで渡さないとだめっぽい。
- スクリプトの最後でSketchUp自体を終わるようにしておくとコマンドラインツールとして完結できる。SketchUpのウィンドウは表示されるけど、起動時パラメータで非表示にできるだろうか?
以下はd:/test.skpを開いて全グループを分解して上書き保存し、SketchUpを終了するコード。win7で動作確認。macではsend_actionの引数がよろしくないので動かないと思います。
# ungroup_all.rb def ungroup_all Sketchup.open_file "d:/test.skp" entities = Sketchup.active_model.entities entities.each do |entity| if entity.typename == "Group" entity.explode end end Sketchup.send_action(57603) # save Sketchup.send_action(57665) # exit end ungroup_all()
ってこれだと入れ子のグループが怪しいですね。そのうち直します。
参考:
SketchUp Command Line: RubyStartup • sketchUcation • 1
Google グループ
batch file - Is there a command line in Google Sketchup to export in 3ds or fbx format? - Stack Overflow
Google グループ