Google Sketchup中是否有命令行以3ds或fbx格式导出?

odl*_*dle 4 export batch-file 3ds sketchup

我正在寻找一种方法将一些skp,kmz或dae文件一次转换为3ds或fbx格式.在sketchup pro中你可以导出为... 3ds或fbx但是打开每个文件并导出它需要很长时间.Sketchup中是否有命令行,或者可以使用脚本来自动执行此过程?谢谢

PA.*_*PA. 10

您需要从命令行调用sketchup,指定要立即运行的脚本

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

在你的ruby脚本中(runexport.rb)你可以

  1. 加载你的模型.请参阅http://code.google.com/apis/sketchup/docs/ourdoc/model.html#import

  2. 导出你的模型.请参阅http://code.google.com/apis/sketchup/docs/ourdoc/model.html#export

  3. 最后,关闭sketchup.请参阅http://forums.sketchucation.com/viewtopic.php?f=180&t=29162

对于递归遍历目录,请尝试使用此ruby代码(来自维基百科)

使用正则表达式匹配模式

#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$/)
Run Code Online (Sandbox Code Playgroud)