What is the Ruby script for selecting all scenes

How to select all scenes instead of the active scenes only?

Example:
Sketchup::active_model.rendering_options[“DisplayWatermarks”]= true

How do I select all scenes?

You have to retrieve all of them from the collection.

Scenes are called pages

model = Sketchup.active_model
pages = model.pages

Sketchup::active_model.pages.rendering_options[“DisplayWatermarks”]= true

Like this? Didn’t work.

You have to combine (each) Class: Sketchup::Pages — SketchUp Ruby API Documentation with (selected) Class: Sketchup::Pages — SketchUp Ruby API Documentation

I tried, still not sure. Couldn’t get it to work. The current script is working, but we have to use this on each scene, one by one, to remove them. So lets say we want to use this current script.

Sketchup::active_model.rendering_options[“DisplayWatermarks”]= false

Currently most of the scenes have watermarks, how do we remove them all, or disable them, without the need to go every scene to disable them individually.

Please write code correctly

You have to set one by one. At least to my knowledge. I’m not in front of the computer right now to check it out.

Make a script to set each one as active and after that apply watermark, then go to next page.

Try this:

model = Sketchup.active_model
pages = model.pages

pages.each do |page|
  pages.selected_page = page
  #your code here  
end

Not tested :wink:

I tried this and didn’t work

model = Sketchup.active_model
pages = model.pages

pages.each do |page|
pages.selected_page = page
model.rendering_options[“DisplayWatermarks”]= false
end

=> nil

It went through all the scenes, but did not disable the watermarks. :frowning_face:

Your code must update your scene.

Also your code is not written correctly, please read the link how to post correctly

If your code works with the actual scene it should work.
Why don’t you define a style with watermarks and apply that style to each scene?

To be exact, each project will have many scenes,

Example: Project A have 10 scenes. Every “Even” page scene have Watermark Enable. And every “Odd” page scene does not. Rather then going to every scene to disable the scene, is the a global setting or a ruby script to disable Watermark Display for all Scene in Project A.

I want to disable all the Watermark Display for all my projects.

Watermark is under Styles settings

You can change the style with the watermark included.

Yes, this is correct. But this setting is done scene by scene. Is there a place where I can set for all the Scene/page at one go?

Can you share one model to view how to help you?

well no it’s style by style. so if all your scenes use the same style, it’s immediate. off course, if each scene has a different style, it’s a bit more of work

1 Like

This has been covered previously. You create styles (usually from default style that comes with SketchUp,) and change the rendering options for the style. Then assign a page (or pages) to use that style.

Is it possible to set related content in the style? - #3 by DanRathbun

How can update rendering_options of page? - #11 by DanRathbun