How to get list of all scenes and switch to a selected scene?


I am developing an extension where I want to show the list of scenes for the model.
If user selects a scene then write the scene to an image.


These should help:


Thanks a lot @jiminybillybob. That is what i was looking for.


Barebones example …

model = Sketchup.active_model
pages = model.pages

prompts = [ "Choose scene for export" ]
defaults = [ ]
list =  ['|') ]
caption = "Export Scene to Image"

choice = UI.inputbox( prompts, defaults, list, caption )

if choice # false if user cancels
  pages.selected_page= pages[choice]
  pathname = UI.savepanel("Save view as ...", ENV["HOME"], "#{choice}.png")
  if pathname # nil if user cancels
      # Options
      filename: pathname,
      width:  800,
      height: 600,
      antialias:   true,
      compression: 0.9,
      transparent: true
  end # IF pathname
end # IF choice

Homework assignment:

Modify the choice inputbox (or add a second inputbox just before the image write,) to add the user’s desired options for width, height, antialias, etc.


Thank you @DanRathbun.