Skip to content

Instantly share code, notes, and snippets.

@oiehot
Last active February 18, 2017 03:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oiehot/04d3ac2d0994b2a717ba07641466e5b4 to your computer and use it in GitHub Desktop.
Save oiehot/04d3ac2d0994b2a717ba07641466e5b4 to your computer and use it in GitHub Desktop.
def exportFbx(filename)
if Sketchup.open_file(filename) then
model = Sketchup.active_model
dir = File.dirname(filename)
basename = File.basename(filename,'.*')
#model.save_thumbnail "#{dir}/#{basename}.png"
model.export "#{dir}/#{basename}.fbx", false
else
puts "Failed to Load fbx."
end
end
def exportDir(path)
Dir[path + '/*'].sort.each do |name|
puts name
if File.file?(name) and name[/.+\.skp$/]
exportFbx(File.expand_path(name))
elsif File.directory?(name)
exportDir(name)
end
end
end
exportDir('c:/project/sketchup/model')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment