Automating export of scenes
-
-
Thanks again TIG. I will try it out tomorrow as it's time for dinner hereabouts. Did you have a look at the post links? I would be interested to have your opinion on whether the ruby part is possible.
Cheers
Chris
-
Try something like this...
def scenes2images() model=Sketchup.active_model view=model.active_view width=view.vpwidth.to_int height=view.vpheight.to_int ### you can change the width/height away from the default if you desire pages=model.pages pages_times=[] pages.each{|page|pages_times.push([page,page.transition_time]) page.transition_time=0.0 } ### remembers pages' transition times and sets them all to 0 filepath=File.dirname(model.path)+"\\" ### assumes model is saved 0.upto(pages.count-1)do|images| ### this msgbox pauses and lets each view refresh and the image process... UI.messagebox("Exporting Image of Scene...") model.active_view.write_image("#{filepath+pages.selected_page.name}.jpg",width,height,true) Sketchup.send_action("pageNext;") end#loop ### reset pages' transition times pages_times.each{|array|array[0].transition_time=array[1]} UI.messagebox("Scenes' Image Exporting - Completed.") end#defsave as scenes2images.rb and scenes2images in the ruby console to run it...
-
Thanks again TIG. Here's your code that I have altered a bit (in black) to be later made into a callback. Hope that's OK with you.
My regards
Chris
` def scenes2images()
%(#000000)[# variables from js in webdialog
subdir = "E:/Chiang Mai/Scenes jpg/"
w = 800]model=Sketchup.active_model view=model.active_view width=view.vpwidth.to_int height=view.vpheight.to_int %(#000000)[width = w height = w/width*height]you can change the width/height away from the default if you desire
pages=model.pages pages_times=[] pages.each{|page|pages_times.push([page,page.transition_time]) page.transition_time=0.0 }remembers pages' transition times and sets them all to 0
filepath=File.dirname(model.path)+"\" ### assumes model is saved
## changed to subdir variable - see above
0.upto(pages.count-1)do|images|
%(#000000)[# using 2 just for testing
0.upto(2)do|images|]
model.active_view.write_image("#{subdir+pages.selected_page.name}.jpg",width,height,true)
Sketchup.send_action("pageNext:")%(#000000)[UI.messagebox("Exported "+pages.selected_page.name)]this msgbox pauses and lets each view refresh and the image process...
%(#000000)[## changed position to get correct scene name
considering change to question with OK/Skip/Cancel + new position]
end#loop
reset pages' transition times
pages_times.each{|array|array[0].transition_time=array[1]}
UI.messagebox("Scene Image Exporting - Completed.")
end#def` -
SceneExporter and SceneExporterPro will do this as well.
-
@rickw said:
SceneExporter and SceneExporterPro will do this as well.
Very thoughtful and generous, thanks.
You may be interested in seeing how this relates to my templates query
Chris
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement