Class: Sketchup::Page

Inherits:
Entity
  • Object
show all

Overview

The Page class contains methods to extract information and modify the properties of an individual page.

Note that inside the SketchUp user interface pages are called “Scenes”.

Since SketchUp 2026.0, modifying the Axes, Camera, RenderingOptions, and ShadowInfo properties of a page is an undoable operation and should be wrapped between Model#start_operation and Model#commit_operation. Example:

model = Sketchup.active_model
pages = model.pages
origin = Geom::Point3d.new(10, 0, 0)

model.start_operation("Set Page Properties")
page = pages.add("My Page")
page.axes.set(origin, Y_AXIS, X_AXIS, Z_AXIS)
page.camera.fov = 56.78
page.shadow_info["City"] = "Brasov, Romania"
page.rendering_options["BackgroundColor"] = "Pink"
model.commit_operation

Version:

  • SketchUp 6.0

Instance Method Summary # collapse

Methods inherited from Entity

#add_observer, #attribute_dictionaries, #attribute_dictionary, #delete_attribute, #deleted?, #entityID, #get_attribute, #inspect, #model, #parent, #persistent_id, #remove_observer, #set_attribute, #to_s, #typename, #valid?

Instance Method Details

#active_section_planesArray<Sketchup::SectionPlane>?

The #active_section_planes method is used to retrieve the active section plane for the Sketchup::Page.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add('My Page')
page.active_section_planes

Returns:

Version:

  • SketchUp 2026.0

#axesSketchup::Axes

The axes method returns the drawing axes for the page.

Since SketchUp 2026.0, modifying the axes of a scene is an undoable operation.

Examples:

model = Sketchup.active_model
page = model.pages.add("Example Page")
xaxis = Geom::Vector3d.new(3, 5, 0)
yaxis = xaxis * Z_AXIS
page.axes.set([10,0,0], xaxis, yaxis, Z_AXIS)
page.update(PAGE_USE_ALL)
page.axes

Returns:

Version:

  • SketchUp 2016

#cameraSketchup::Camera

The #camera method retrieves the camera for a particular page.

Since SketchUp 2026.0, modifying the camera properties of a scene is an undoable operation.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
camera = page.camera

Returns:

Version:

  • SketchUp 6.0

#delay_timeFloat

The delay_time method retrieves the amount of time, in seconds, that a page will be displayed before transition to another page during a tour.

The default delay time can be modified in the Model Info > Animation panel of the SketchUp User Interface. If this method returns -1, the default delay time is used.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
time = page.delay_time

Returns:

  • (Float)

    the number of seconds of delay.

Version:

  • SketchUp 6.0

#delay_time=(seconds) ⇒ Object

The delay_time= method sets the amount of time, in seconds, that a page will be displayed before transitioning to another page during a tour. If you set the delay for a page to be -1, the default delay time will be used.

The default delay time can be modified in the Model Info > Animation panel of the SketchUp User Interface.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
time = page.delay_time = 10

Parameters:

  • seconds (Float)

    The number of seconds to set as the delay time.

Version:

  • SketchUp 6.0

#descriptionString

The description method retrieves the description for a page as found in the Scenes manager dialog.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
description = page.description

Returns:

  • (String)

    a textual description for the page.

Version:

  • SketchUp 6.0

#description=(description) ⇒ Object

The description method sets the description for a page as found in the Scenes manager dialog.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
description = page.description = "This is my first page"

Parameters:

  • description (String)

    A string description for the page.

Version:

  • SketchUp 6.0

#environmentSketchup::Environment

The #environment method is used to retrieve the Environment for the scene.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add('My Page')
page.environment

Returns:

Version:

  • SketchUp 2025.0

#environment=(environment) ⇒ Object

The #environment= method is used to set the Environment for the scene.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add('My Page')
path = 'path/to/environment.hdr'
environment = model.environments.add('My Environment', path)
page.environment = environment

Parameters:

Version:

  • SketchUp 2025.0

#get_drawingelement_visibility(element) ⇒ Boolean

The #get_drawingelement_visibility method is used to get the visibility of a drawing element on a particular page.

Examples:

model = Sketchup.active_model
entities = model.active_entities
point1 = Geom::Point3d.new(10,0,0)
constpoint = entities.add_cpoint(point1)
pages = model.pages
page = pages.add("My Page")
result = page.get_drawingelement_visibility(constpoint)
# SketchUp 2020.1 is required
def element_visible_in_page?(element, page)
  case element
  when Sketchup::ComponentInstance, Sketchup::Group
    return unless page.use_hidden_objects?
  else
    return unless page.use_hidden_geometry?
    return unless element.parent == Sketchup.active_model
  end
  page.get_drawingelement_visibility(element)
end

Parameters:

Returns:

  • (Boolean)
    • true if visible, false if not.

Version:

  • SketchUp 2020.0

#hidden_entitiesArray<Sketchup::Drawingelement>?

Note:

Behavior depends on which hidden-visibility flags are used:

  • SketchUp 2020.1 and later:

    • If page.use_hidden_geometry? && page.use_hidden_objects? => returns all top-level drawing elements hidden by the page.

    • If page.use_hidden_geometry? && !page.use_hidden_objects? => returns only non-instance drawing elements (not ComponentInstance or Group) hidden by the page.

    • If !page.use_hidden_geometry? && page.use_hidden_objects? => returns only ComponentInstance, Group and Image instances hidden by the page.

    • If both are false => returns nil.

  • SketchUp 2019 and earlier:

    • Returns an array when page.use_hidden? is true, otherwise nil.

Returns the drawing elements whose visibility is overridden by this page.

Only top-level Drawingelements are controlled by scene visibility. For nested content, only ComponentInstance, Group and Image instances are affected.

Examples:

model = Sketchup.active_model
page  = model.pages.add("My Page")
hidden = page.hidden_entities
if hidden
  puts "Hidden on page: #{hidden.size}"
else
  puts "Page does not store hidden-entity visibility."
end

Returns:

Version:

  • SketchUp 6.0

#include_in_animation=(include) ⇒ Object

The #include_in_animation= method controls whether the page should be included when exporting an animation from the model.

Examples:

Turn off animation for all pages.

model = Sketchup.active_model
model.pages.each { |page|
  page.include_in_animation = false
}

Parameters:

  • include (Boolean)

Version:

  • SketchUp 2018

#include_in_animation?Boolean

The #include_in_animation? method determines whether the page should be included when exporting an animation from the model.

Examples:

model = Sketchup.active_model
in_animation = model.pages.select { |page| page.include_in_animation? }

Returns:

  • (Boolean)

Version:

  • SketchUp 2018

#labelString

The label method retrieves the label for a page from the page tab.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
label = page.label

Returns:

  • (String)

    label for the page tab.

Version:

  • SketchUp 6.0

#layer_foldersArray<Sketchup::LayerFolder>?

The #layer_folders method retrieves the hidden layer folders associated with a page.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add("My Page")
folders = page.layer_folders

Returns:

Version:

  • SketchUp 2021.0

#layersArray<Sketchup::Layer>?

The #layers method retrieves layers that don't use their default visibility on this page.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add("My Page")
layers = page.layers

Test layer visibility

def layer_visible_in_page?(layer, page)
  return layer.visible? if page.parent.selected_page == page
  return nil unless page.use_hidden_layers?
  page.layers.include?(layer) == hidden_by_default?(layer)
end

def hidden_by_default?(layer)
  layer.page_behavior & LAYER_HIDDEN_BY_DEFAULT == LAYER_HIDDEN_BY_DEFAULT
end

Returns:

Version:

  • SketchUp 6.0

#nameString

The name method retrieves the name for a page from the page tab.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
name = page.name

Returns:

  • (String)

    name for the page tab.

Version:

  • SketchUp 6.0

#name=(name) ⇒ Object

The #name= method sets the name for a page's tab. If the name is already used by another page, a unique name is created.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
name = page.name = "Page Name"

Parameters:

  • name (String)

    The name of the page to be set.

Version:

  • SketchUp 6.0

Known Bugs:

  • Prior to SketchUp 2026.0 this method did not make the name unique.

#rendering_optionsSketchup::RenderingOptions

Note:

Most rendering options of a scene are also present in Style and are governed by the selected style. Those options should not be changed from the scene. The ones not related to Style like fog (DisplayFog, FogColor) are safe to be changed from the scene.

The rendering_options method retrieves a RenderingOptions object for the page.

Since SketchUp 2026.0, modifying rendering_options of a scene is an undoable operation.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add("My Page")
renderingoptions = page.rendering_options

Returns:

See Also:

Version:

  • SketchUp 6.0

#set_drawingelement_visibility(element, visibility) ⇒ Boolean

The #set_drawingelement_visibility method is used to change the visibility of a drawing element on a particular page. Only drawing elements on the root of the model, as well as nested instances of components, groups, and images are controlled by Page visibility.

Examples:

model = Sketchup.active_model
entities = model.active_entities
point1 = Geom::Point3d.new(10, 0, 0)
constpoint = entities.add_cpoint(point1)
pages = model.pages
page = pages.add("My Page")
page.set_drawingelement_visibility(constpoint, false)

Parameters:

Returns:

  • (Boolean)

Version:

  • SketchUp 2020.0

#set_visibility(layer, visible_for_page) ⇒ Sketchup::Page #set_visibility(layer_folder, visible_for_page) ⇒ Sketchup::Page

The #set_visibility method sets the visibility for a layer or layer folder on a page.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add("My Page")
layer = model.layers.add("My Layer")
page.set_visibility(layer, false)

Overloads:

Returns:

Version:

  • SketchUp 6.0

#shadow_infoSketchup::ShadowInfo

Note:

While certain shadow settings, such as those available in the Shadows panel, can be controlled on a per-page basis, global settings like north angle, latitude, and longitude are managed at the model level and are not page-specific.

The #shadow_info method retrieves the ShadowInfo object for the page.

Since SketchUp 2026.0, modifying shadow_info of a scene is an undoable operation.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
shadowinfo = page.shadow_info

Returns:

Version:

  • SketchUp 6.0

#styleSketchup::Style

The style method retrieves the style associated with the page.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
style = page.style

Returns:

See Also:

Version:

  • SketchUp 6.0

#transition_timeFloat

Get the amount of time that it takes to transition to this page during a slideshow or animation export. If this value is -1, it means to use the default transition time.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
time = page.transition_time

Returns:

  • (Float)

    the amount of time it takes to transition to this page during a slideshow or animation export.

Version:

  • SketchUp 6.0

#transition_time=(trans_time) ⇒ Object

The transition_time= method is used to set the transition time.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
time = page.transition_time=20

Parameters:

  • trans_time (Float)

    The transition time in seconds.

Version:

  • SketchUp 6.0

#update(flags) ⇒ Boolean

The #update method performs an update on the page properties based on the current view that the user has. What properties of the Page get updated are controlled via an integer whose bits corresponds to different properties. These flags can be used individually or combined using bitwise OR.

PAGE_USE_CAMERA            # Camera Location
PAGE_USE_RENDERING_OPTIONS # Drawing Style
PAGE_USE_SHADOWINFO        # Shadow Setting
PAGE_USE_SKETCHCS          # Axes Location
PAGE_USE_HIDDEN            # Hidden Geometry & Objects (Up 2019 and older)
PAGE_USE_HIDDEN_GEOMETRY   # Hidden Geometry (SU 2020 and later)
PAGE_USE_HIDDEN_OBJECTS    # Hidden Objects (SU 2020 and later)
PAGE_USE_LAYER_VISIBILITY  # Visible Layers
PAGE_USE_SECTION_PLANES    # Active Section Planes
PAGE_USE_ALL               # All possible scene properties
PAGE_USE_ENVIRONMENT       # Environment settings

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
status = page.update

# Updates Camera Location, Shadow Settings and Visible Layers.
flags = PAGE_USE_CAMERA | PAGE_USE_SHADOWINFO | PAGE_USE_LAYER_VISIBILITY
status = page.update(flags)

Parameters:

  • flags (Integer)

    The bitwise OR of the bit flags.

Returns:

  • (Boolean)

Version:

  • SketchUp 6.0

#use_axes=(setting) ⇒ Object

The use_axes= method sets the page's axes property.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
# Set use_axes to false
status = page.use_axes=false

Parameters:

  • setting (Boolean)

    true if you want your page to save this property, false if you do not want your page to save this property.

Version:

  • SketchUp 6.0

#use_axes?Boolean

The use_axes? method determines whether you are storing the axes property with the page.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
status = page.use_axes?

Returns:

  • (Boolean)

    true if you are storing the this property with the page, false if you are not storing this property with the page.

Version:

  • SketchUp 6.0

#use_camera=(setting) ⇒ Object

The use_camera= method sets the page's camera property.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
status = page.use_camera = true

Parameters:

  • setting (Boolean)

    true if you want your page to save this property, false if you do not want your page to save this property.

Version:

  • SketchUp 6.0

#use_camera?Boolean

The use_camera? method determines whether you are storing the camera property with the page.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
status = page.use_camera?

Returns:

  • (Boolean)

    true if you are storing the this property with the page, false if you are not storing this property with the page.

Version:

  • SketchUp 6.0

#use_environment=(use_environment) ⇒ Object

The #use_environment= method is used to set if the Environment settings are used in the scene.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add('My Page')
page.use_environment?
# => true
page.use_environment = false
page.use_environment?
# => false

Parameters:

  • use_environment (Boolean)

Version:

  • SketchUp 2025.0

#use_environment?Boolean

The #use_environment? method is used to determine if the Environment settings are used in the scene.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add('My Page')
page.use_environment?
# => true
page.use_environment = false
page.use_environment?
# => false

Returns:

  • (Boolean)

Version:

  • SketchUp 2025.0

#use_hidden=(setting) ⇒ Object

Deprecated.

The functionality is replaced by #use_hidden_geometry= and #use_hidden_objects= in SketchUp 2020.1.

The use_hidden= method sets the page's hidden property.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
status = page.use_hidden = false

Parameters:

  • setting (Boolean)

    true if you want your page to save this property, false if you do not want your page to save this property.

See Also:

Version:

  • SketchUp 6.0

#use_hidden?Boolean

Deprecated.

The functionality is replaced by #use_hidden_geometry? and #use_hidden_objects? in SketchUp 2020.1.

The use_hidden? method determines whether you are storing the hidden property with the page.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add("My Page")
status = page.use_hidden?

Returns:

  • (Boolean)

    true if you are storing the this property with the page, false if you are not storing this property with the page.

See Also:

Version:

  • SketchUp 6.0

#use_hidden_geometry=(setting) ⇒ Object

Sets the page's use hidden geometry property.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add("My Page")
status = page.use_hidden_geometry = false

Parameters:

  • setting (Boolean)

    `true` if you want your page to save this property, `false` if you do not want your page to save this property.

Version:

  • SketchUp 2020.1

#use_hidden_geometry?Boolean

Returns the use hidden geometry property from the page.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add("My Page")
status = page.use_hidden_geometry?

Returns:

  • (Boolean)

Version:

  • SketchUp 2020.1

#use_hidden_layers=(setting) ⇒ Object

The use_hidden_layers= method sets the page's hidden layers property.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
status = page.use_hidden_layers = false

Parameters:

  • setting (Boolean)

    true if you want your page to save this property, false if you do not want your page to save this property.

Version:

  • SketchUp 6.0

#use_hidden_layers?Boolean

The use_hidden_layers? method determines whether you are storing the hidden layers property with the page.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
status = page.use_hidden_layers?

Returns:

  • (Boolean)

    true if you are storing the this property with the page, false if you are not storing this property with the page.

Version:

  • SketchUp 6.0

#use_hidden_objects=(setting) ⇒ Object

Sets the page's use hidden objects property.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add("My Page")
status = page.use_hidden_objects = false

Parameters:

  • setting (Boolean)

    `true` if you want your page to save this property, `false` if you do not want your page to save this property.

Version:

  • SketchUp 2020.1

#use_hidden_objects?Boolean

Returns the use hidden objects property from the page.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add("My Page")
status = page.use_hidden_objects?

Returns:

  • (Boolean)

Version:

  • SketchUp 2020.1

#use_rendering_options=(use_options) ⇒ Object

Note:

Setting this property will also affect the value of #use_style?. Setting it to `false` will also cause #use_style? to become `false`.

The use_rendering_options= method sets whether the page saves its own unique rendering options. In the UI, this corresponds to the “Style and Fog” checkbox in the Scenes panel.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
# This will uncheck the "Style and Fog" property for the page.
page.use_rendering_options = false

Parameters:

  • use_options (Boolean)

    `true` to have the page save Style and Fog properties, `false` otherwise.

Version:

  • SketchUp 6.0

#use_rendering_options?Boolean

Note:

This method is linked to #use_style?. They both check the same property and will always return the same value. This is because a Style is the object that contains rendering options.

The use_rendering_options? method determines if the page saves its own unique rendering options. In the UI, this corresponds to the “Style and Fog” checkbox in the Scenes panel.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
status = page.use_rendering_options?

Returns:

  • (Boolean)

    true if the page saves Style and Fog properties.

Version:

  • SketchUp 6.0

#use_section_planes=(setting) ⇒ Object

The use_section_planes= method sets the page's section planes property.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
status = page.use_section_planes=false

Parameters:

  • setting (Boolean)

    true if you want your page to save this property, false if you do not want your page to save this property.

Version:

  • SketchUp 6.0

#use_section_planes?Boolean

The use_section_planes? method determines whether you are storing the section planes property with the page.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
status = page.use_section_planes?

Returns:

  • (Boolean)

    true if you are storing the this property with the page, false if you are not storing this property with the page.

Version:

  • SketchUp 6.0

#use_shadow_info=(setting) ⇒ Object

The use_shadow_info= method sets the page's shadow info property.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
status = page.use_shadow_info=false

Parameters:

  • setting (Boolean)

    true if you want your page to save this property, false if you do not want your page to save this property.

Version:

  • SketchUp 6.0

#use_shadow_info?Boolean

The use_shadow_info? method determines whether you are storing the shadow info property with the page.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
status = page.use_shadow_info?

Returns:

  • (Boolean)

    true if you are storing the this property with the page, false if you are not storing this property with the page.

Version:

  • SketchUp 6.0

#use_style=(style) ⇒ Object

Note:

This method is inconsistent with other setters in the API as it does not accept a boolean. To enable style properties for a page, you must assign a Style object.

Note:

Assigning a style to a page will automatically set #use_rendering_options? to `true`.

The use_style= method sets the style to be used by the page.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
style = model.styles[0]
# This assigns the style AND sets page.use_rendering_options? to true.
page.use_style = style

Returns The assigned Style object.

Parameters:

Returns:

  • The assigned Style object.

Version:

  • SketchUp 6.0

#use_style?Boolean

Note:

This method is linked to #use_rendering_options?. They both check the same property and will always return the same value. This is because a Style is the object that contains rendering options.

The use_style? method determines if the page saves style properties.

Examples:

model = Sketchup.active_model
pages = model.pages
page = pages.add "My Page"
use_style = page.use_style?

Returns:

  • (Boolean)

    true if the page saves Style and Fog properties.

Version:

  • SketchUp 6.0