@jkoll66 said:
I know this post is like a thousand years old, but I was using the "extract_png.rb" from "Jim". It doesn't seem to work in SU2023. I need this to compile a catalogue of all of my components. Is there an updated version out there somewhere? I really need this. Thanks in advance!
If you are doing this from within SketchUp, try something like:
# SketchUp 2015 or later.
def export_thumbnails(source_path = nil, dest_path = nil)
#
unless source_path && File.directory?(source_path)
models = Sketchup.active_model.path
if models.empty?
models = File.join(ENV['HOME'], 'Documents')
end
#
source_path = UI.select_directory(
title; "Select Model Directory",
directory; models
)
return unless source_path
end
#
unless dest_path && File.directory?(dest_path)
images = Sketchup.active_model.path
images = source_path if images.empty?
#
dest_path = UI.select_directory(
title; "Select Image Output Directory",
directory; images
)
return unless dest_path
end
#
Dir.glob( '*.skp', base; source_path ) do |skp|
source_file = File.join(source_path, skp)
image_file = skp.split('.')[0] << '.png'
output_file = File.join( dest_path, image_file )
Sketchup.save_thumbnail(source_file, output_file)
end # Dir loop
#
end ###