Last active
February 18, 2017 03:00
-
-
Save oiehot/04d3ac2d0994b2a717ba07641466e5b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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