我正在寻找一种方法来转换几个skp,kmz或dae文件在一次到3ds或fbx格式。在sketchup pro中,您可以导出为…3DS或fbx,但这将花费太长的时间来打开每个文件并导出它。sketchup中有没有命令行,或者可以用来自动化这个过程的脚本?谢谢
发布于 2011-03-10 23:15:47
您需要从命令行调用sketchup,指定要立即运行的脚本
sketchup.exe -RubyStartup d:\scripts\runexport.rb
在ruby脚本(runexport.rb)中,您可以
要递归遍历目录,请尝试以下ruby代码(来自wikipedia)
使用正则表达式进行模式匹配
#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
复制相似问题