#convert skp to obj
#every thumb is putted in a created dir with name of related skp model's name
#skppath is the residence of skpfiles
require 'sketchup.rb'
if(not file_loaded?("skp2obj.rb"))
plugins_menu = UI.menu("Plugins")
plugins_menu.add_item("skp2obj") {file_export}
end
file_loaded("skp2obj.rb")
def file_export
#skp file path
#beware the end "/" e.g. skppath ="i;/skp/skptest/model/error/"
skppath ="i;/tt/"
#open dir and loop all skps
dir = Dir.open(skppath)
begin
dir.each {|x|
next if x !~ /\.skp$/i
x = "#{x}"
sourcefile = skppath+x
x = x[0,x.length-4]
destdir = skppath + x + "/"
destfile = destdir + x +".obj"
#mak dir
Dir.mkdir(destdir)
#open modle file
Sketchup.file_new
status = Sketchup.open_file sourcefile
if (!status)
UI.messagebox "error; " + sourcefile
end
#export obj
status = Sketchup.active_model.export destfile
if (!status)
UI.messagebox "error; " + sourcefile
end
}
ensure
dir.close
end
UI.messagebox "Finished"
end
💡 LightUp 7.1 | SketchUp's only real-time renderer that uses object-based rendering
Download Trial
C
Latest posts made by ccsing
-
RE: Looking for a batch export .skp to .dxf ruby