I’m looking for a way (i’m thinking ruby code or an extension) to export multiple views with a single action. I have hundreds of .skp that I need to export to .png, (viewFront:, viewLeft/Right:, viewTop:, viewIso:) I know I could make a scene in each view and export animation, but it feels too repetitive after a while…
I found this code:
model = Sketchup.active_model
scenes = model.pages
@view = model.active_view
@path = chosen_folder = UI.select_directory(title: "Select Export Folder")
def scene_img(name)
keys = {
:filename => "#@path/#{name}.png",
:antialias => true,
:compression => 0,
:transparent => true
}
@view.write_image keys
end
scenes.each do |s|
scenes.selected_page = s
name = s.name
scene_img(name)
end
it kind of does what I want, but still with scenes… im not good with code but i assume a ruby code would be doable, if it is possible to name the images like filename_view.png that would be perfect.
Hi!
I used this code to export scenes in 2017 sketchup and it worked great!
But in version 2022, the same code exports images with artifacts. Does anyone know how to fix this? P.S. built-in export methods in sketch 2022 work without artifacts
I think earlier versions was bugged, and saved with a higher compression quality than requested. You are asking for the lowest quality (:compression => 0) here, increase it and you should see the JPEG compression artifacts go away. I’d start at something like 0.8 and slowly increase until you get satisfactory result.