How can update rendering_options of page?

Modify rendering parameters only in the current scene.

It’s invalid.

Sketchup.active_model.rendering_options['DisplaySectionCuts'] = false
Sketchup.active_model.rendering_options['DisplaySectionPlanes'] = false
Sketchup.active_model.pages.selected_page.use_rendering_options= true
Sketchup.active_model.pages.selected_page.use_section_planes= true
Sketchup.active_model.pages.selected_page.update PAGE_USE_ALL

(1) You must navigate to the scene page you wish to change,

(2) then be sure to set the certain Boolean flags true:
page.use_rendering_options= true
page.use_section_planes= true
page.use_style= my_style_for_this_page

(3) Then update the page.

Basically, you must have a page selected and displayed to change any rendering options or style attributes.

If it is a style attribute you wish to change, and if the page has it’s own style object, then you must also select the page’s style in the Styles collection with styles.selected_style=, and then update the page’s style with styles.update_selected_style.

Keep in mind that many rendering options are really Style attributes and the RenderingOptions interface is just a means to access these style attributes.

1 Like

We unfortunately have no direct API to change many of the scene properties. For now you typically have to update the current view and update the scene.

As Dan says the rendering options aren’t saved directly to the Scene but to the Style. This means you can activate the style, update it and switch back to the previous style without changing the active scene, but it also means changes to that Style applies to any Scenes using the same style.

Yes, I saw that post (Set rendering option "SectionCutDrawEdges" to false - #6 by DanRathbun) .

Yes, I need to use different styles in different scenarios, but I cannot add a style based on the current style.
The API only allows adding a style through a style file.

I hope to add a style based on the user’s current style that only turns off section display and section cutting.

And I also hope to have this option when updating page.

Then load the “Default Styles/Default Style” style …

Sketchup.find_support_file("00Default", "Styles/Default Styles")

… rename it (and perhaps change the description), …

Then copy the style attributes (as needed) from the user’s current style to the new style by doing what I said above. Then make your changes to the user’s current style, then …
Set the new style to the selected_style and call styles.update_selected_style.
Then undo your changes to the current style.

Lastly use the new style by setting a scene to use it.

1 Like

Thank u.
How to get the file of style used by the current user?
It may be self-made

This is not yet exposed to the Ruby API. The C API does have this however.

I opened an API request back in DEC 2019 …

Sketchup::Style#path() · Issue #389 · SketchUp/api-issue-tracker (

… please add your comments, desires & use cases in that API issue thread.

1 Like