Convert .skp to .obj together

Here’s a fuller/better version that actually works !
Save text into a file named TIG-Export.rb
Use Notepad++ [PC] or TextWrangler [MAC] to ensure it is encoded as UTF8-without_BOM
Usage: In Ruby Console,
TIG::Exporter.new("obj")
The passed argument let’s you export to any available file-format…

# encoding: UTF-8
### v2015
module TIG
    module Export
        def self.new(typ="obj")
            dir = UI.select_directory(title: "Select folder of SKPs...")
            return unless dir
            dir.tr!("\\", "/")
            puts "#{dir}\n"
            pwd = Dir.pwd
            Dir.chdir(dir)
            Dir.entries(dir).select{|e| e =~ /[.]skp$/ }.each{|skp|
                    nam = skp.gsub(/skp$/, typ)
                    Sketchup.open_file(skp)
                    puts "#{skp} >>> #{nam}"
                    Sketchup.active_model.export(nam, false)
            }
            Dir.chdir(pwd)
            puts "\nDone."
        end#def
    end#module
 end#module
1 Like