首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Google Sketchup中是否有命令行导出为3ds或fbx格式?

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

Stack Overflow用户
提问于 2011-03-09 20:54:17
回答 1查看 5.9K关注 0票数 4

我正在寻找一种方法来转换几个skp,kmz或dae文件在一次到3ds或fbx格式。在sketchup pro中,您可以导出为…3DS或fbx,但这将花费太长的时间来打开每个文件并导出它。sketchup中有没有命令行,或者可以用来自动化这个过程的脚本?谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-03-10 23:15:47

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

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

在ruby脚本(runexport.rb)中,您可以

  1. 加载您的模型。请参见http://code.google.com/apis/sketchup/docs/ourdoc/model.html#import
  2. export你的模型。最后,请参阅http://code.google.com/apis/sketchup/docs/ourdoc/model.html#export
  3. and,关闭sketchup。请参阅http://forums.sketchucation.com/viewtopic.php?f=180&t=29162

要递归遍历目录,请尝试以下ruby代码(来自wikipedia)

使用正则表达式进行模式匹配

代码语言:javascript
运行
复制
#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$/)
票数 10
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5246082

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档