问题描述
我正在寻找一种将几个skp,kmz或dae文件一次转换为3ds或fbx格式的方法。在sketchup pro中,您可以导出为3ds或fbx,但是打开每个文件并导出它将花费太长时间。草图中有命令行,还是可以用来自动执行此过程的脚本?
感谢
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
推荐答案
您需要从命令行调用sketchup,指定脚本
立即运行
you need to invoke sketchup from the command-line specifying a scriptto run immediately
sketchup.exe -RubyStartup d:\scripts\runexport.rb
可以
-
加载您的模型。请参阅
导出您的模型。请参见
export your model. See http://code.google.com/apis/sketchup/docs/ourdoc/model.html#export
最后,关闭sketchup。请参阅
and finally, shutdown sketchup. See http://forums.sketchucation.com/viewtopic.php?f=180&t=29162
对于递归走路的目录,请尝试这个ruby代码(从维基百科)
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$/)
这篇关于Google Sketchup中是否有以3ds或fbx格式导出的命令行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!