问题描述
我要寻找一种方式来几个SKP,KMZ或DAE文件转换一次到3ds或FBX格式。在SketchUp Pro,您可以做外销为... 3DS或FBX但会花费太长时间打开每个文件并将其导出。有没有在SketchUp命令行,或可用于或许该过程自动化的脚本?
谢谢
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:\\脚本\\ runexport.rb
在你的Ruby脚本( runexport.rb
),你可以
in your ruby script (runexport.rb
) you can
-
加载模型。见<一href=\"http://$c$c.google.com/apis/sketchup/docs/ourdoc/model.html#import\">http://$c$c.google.com/apis/sketchup/docs/ourdoc/model.html#import
导出模型。见<一href=\"http://$c$c.google.com/apis/sketchup/docs/ourdoc/model.html#export\">http://$c$c.google.com/apis/sketchup/docs/ourdoc/model.html#export
最后,关机的SketchUp。见<一href=\"http://forums.sketchucation.com/viewtopic.php?f=180&t=29162\">http://forums.sketchucation.com/viewtopic.php?f=180&t=29162
and finally, shutdown sketchup. See http://forums.sketchucation.com/viewtopic.php?f=180&t=29162
有关递归遍历目录,试试这个红宝石code(维基百科)
For recursively walking the directory, try this ruby code (from wikipedia)
使用常规的前pressions模式匹配
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$/)
这篇关于有没有在谷歌Sketchup的命令行中的3ds或FBX格式导出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!