Is there a command line in Google Sketchup to export in 3ds or fbx format?

久未见 提交于 2019-12-03 10:14:44

问题


I am looking for a way to convert several skp, kmz or dae files at once into 3ds or fbx format. In sketchup pro you can do export as...3ds or fbx but that would take too long to open each file and export it. Is there a command line in sketchup, or a script that could be used to perhaps automate this process? Thanks


回答1:


you need to invoke sketchup from the command-line specifying a script to run immediately

sketchup.exe -RubyStartup d:\scripts\runexport.rb

in your ruby script (runexport.rb) you can

  1. load your model. See http://code.google.com/apis/sketchup/docs/ourdoc/model.html#import

  2. export your model. See http://code.google.com/apis/sketchup/docs/ourdoc/model.html#export

  3. and finally, shutdown sketchup. See http://forums.sketchucation.com/viewtopic.php?f=180&t=29162

For recursively walking the directory, try this ruby code (from wikipedia)

Pattern matching using regular expressions

#define a recursive function that will traverse the directory tree
def printAndDescend(pattern)
  #we keep track of the directories, to be used in the second, recursive part of this function
  directories=[]
  Dir['*'].sort.each do |name|
    if File.file?(name) and name[pattern]
      puts(File.expand_path(name))
    elsif File.directory?(name)
      directories << name
    end
  end
  directories.each do |name|
    #don't descend into . or .. on linux
    Dir.chdir(name){printAndDescend(pattern)} if !Dir.pwd[File.expand_path(name)]
  end
end
#print all ruby files
printAndDescend(/.+\.rb$/)


来源:https://stackoverflow.com/questions/5246082/is-there-a-command-line-in-google-sketchup-to-export-in-3ds-or-fbx-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!