123456789_123456789_123456789_123456789_123456789_

Class: Sketchup::Environment

Relationships
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Entity
Instance Chain:
self, Entity
Inherits: Sketchup::Entity

Overview

An Environment object represents an environment in the model. Environments are used to control the background and lighting of the model. Environments can be used as skydomes, for reflections, and to link the sun to the environment.

Version:

  • SketchUp 2025.0

Instance Attribute Summary

Entity - Inherited

#deleted?

The deleted? method is used to determine if your entity is still valid (not deleted by another script, for example.).

#valid?

The #valid? method is used to determine if your entity is still valid (not deleted by another script, for example).

Instance Method Summary

Entity - Inherited

#add_observer

The add_observer method is used to add an observer to the current object.

#attribute_dictionaries

The attribute_dictionaries method is used to retrieve the AttributeDictionaries collection attached to the entity.

#attribute_dictionary

The attribute_dictionary method is used to retrieve an attribute dictionary with a given name that is attached to an Entity.

#delete_attribute

The #delete_attribute method is used to delete an attribute from an entity.

#entityID

The entityID method is used to retrieve a unique ID assigned to an entity.

#get_attribute

The #get_attribute method is used to retrieve the value of an attribute in the entity’s attribute dictionary.

#inspect

The #inspect method is used to retrieve the string representation of the entity.

#model

The model method is used to retrieve the model for the entity.

#parent

The parent method is used to retrieve the parent of the entity.

#persistent_id

The #persistent_id method is used to retrieve a unique persistent id assigned to an entity.

#remove_observer

The remove_observer method is used to remove an observer from the current object.

#set_attribute

The set attribute is used to set the value of an attribute in an attribute dictionary with the given name.

#to_s

The #to_s method is used to retrieve the string representation of the entity.

#typename

The typename method retrieves the type of the entity, which will be a string such as “Face”, “Edge”, or “Group”.

Instance Attribute Details

#descriptionString (rw)

The #description method gets the description for an Environment.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
puts environment.description # Outputs ""

Returns:

Version:

  • SketchUp 2025.0

#description=(description) (rw)

The #description= method sets the description for an Environment.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
environment.description = 'This is an example of description'
puts environment.description # Outputs "This is an example of description"

Parameters:

  • description (String)

    the new description for the environment

Version:

  • SketchUp 2025.0

#linked_sun=(linked_sun) (rw)

The #linked_sun= method is used to set if the Environment is linked to the sun. Shadow lighting is used to create realistic shadows in the scene, enhancing the visual quality.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
environment.linked_sun = true
puts environment.linked_sun? # Outputs true

Parameters:

  • linked_sun (Boolean)

    true if the environment should be linked to the sun, false otherwise

Version:

  • SketchUp 2025.0

#linked_sun?Boolean (rw)

The #linked_sun? method is used to determine if the Environment is linked to the sun. This function returns a boolean value indicating whether the shadow light feature is currently enabled in the environment. Shadow lighting is used to create realistic shadows in the scene, enhancing the visual quality.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
puts environment.linked_sun? # Outputs false

Returns:

  • (Boolean)

    true if the environment is linked to the sun, false otherwise

Version:

  • SketchUp 2025.0

#linked_sun_positionGeom::Point3d (rw)

The #linked_sun_position method is used to get the position of the sun linked to the Environment. The position is a ::Geom::Point3d where the x must be in range [0.0, 1.0] and y must be in range [-1.0, 1.0].

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
puts environment.linked_sun_position # Outputs Geom::Point3d(0, 0, 0)

Returns:

  • (Geom::Point3d)

    the position of the sun linked to the environment

Version:

  • SketchUp 2025.0

#linked_sun_position=(sun_position) ⇒ Geom::Point3d (rw)

The #linked_sun_position= method is used to set the position of the sun linked to the Environment. The position is a ::Geom::Point3d where the x must be in range [0.0, 1.0] and y must be in range [-1.0, 1.0].

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
environment.linked_sun_position = Geom::Point3d.new(0, 1)
puts environment.linked_sun_position # Outputs Geom::Point3d(0, 1, 0)

Parameters:

  • sun_position (Geom::Point3d)

    the new position of the sun linked to the environment

Returns:

  • (Geom::Point3d)

    the new position of the sun linked to the environment

Version:

  • SketchUp 2025.0

#nameString (rw)

The #name method retrieves the name of the Environment. This is the unique internal name of the object which should be used for retrieving the Environment from the model’s Environments.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
puts environment.name # Outputs "Example"

Returns:

  • (String)

    the name of the environment

Version:

  • SketchUp 2025.0

#name=(name) ⇒ String (rw)

The #name= method sets the name for an Environment.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
environment.name = 'New Name'
puts environment.name # Outputs "New Name"

Parameters:

  • name (String)

    the new name for the environment

Returns:

  • (String)

    the new name of the environment

Version:

  • SketchUp 2025.0

#reflection_exposureFloat (rw)

Note:

Reflection exposure is a value between 0.0 and 10.0, where 0.0 is no exposure and 10.0 is full exposure.

The #reflection_exposure method is used to get the exposure of the Environment for reflections.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
puts environment.reflection_exposure # Outputs 1
environment.reflection_exposure = 0.5
puts environment.reflection_exposure # Outputs 0.5

Returns:

  • (Float)

    the exposure of the environment for reflections

Version:

  • SketchUp 2025.0

#reflection_exposure=(reflection_exposure) ⇒ Float (rw)

Note:

Reflection exposure is a value between 0.0 and 10.0, where 0.0 is no exposure and 10.0 is full exposure.

The #reflection_exposure= method is used to set the exposure of the Environment for reflections.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
puts environment.reflection_exposure # Outputs 1
environment.reflection_exposure = 0.5
puts environment.reflection_exposure # Outputs 0.5

Parameters:

  • reflection_exposure (Float)

    the new exposure of the environment for reflections

Returns:

  • (Float)

    the new exposure of the environment for reflections

Version:

  • SketchUp 2025.0

#rotationFloat (rw)

The #rotation method is used to get the vertical rotation angle in degrees to apply to the Environment.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
puts environment.rotation # Outputs 0.0 degrees
environment.rotation = 90.0
puts environment.rotation # Outputs 90.0 degrees

Returns:

  • (Float)

    rotation in degrees

#rotation=(rotation) ⇒ Float (rw)

Note:

Rotation is a value between 0.0 and 360.0 degrees.

The #rotation= method is used to set the the vertical rotation angle in degrees to apply to the Environment.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
puts environment.rotation # Outputs 0.0 degrees
environment.rotation = 90.0
puts environment.rotation # Outputs 90.0 degrees

Parameters:

  • rotation (Float)

Version:

  • SketchUp 2025.0

#skydome_exposureFloat (rw)

Note:

Skydome exposure is a value between 0.0 and 20.0, where 0.0 is no exposure and 20.0 is full exposure.

The #skydome_exposure method is used to get the exposure of the Environment.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
puts environment.skydome_exposure # Outputs 1
environment.skydome_exposure = 0.5
puts environment.skydome_exposure # Outputs 0.5

Returns:

  • (Float)

    the exposure of the environment

Version:

  • SketchUp 2025.0

#skydome_exposure=(skydome_exposure) ⇒ Float (rw)

Note:

Skydome exposure is a value between 0.0 and 20.0, where 0.0 is no exposure and 20.0 is full exposure.

The #skydome_exposure= method is used to set the exposure of the Environment.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
puts environment.skydome_exposure # Outputs 1
environment.skydome_exposure = 0.5
puts environment.skydome_exposure # Outputs 0.5

Parameters:

  • skydome_exposure (Float)

    the new exposure of the environment

Returns:

  • (Float)

    the new exposure of the environment

Version:

  • SketchUp 2025.0

#use_as_skydome=(use_as_skydome) (rw)

The #use_as_skydome= method is used to set if the Environment is used as a skydome.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
environment.use_as_skydome = true
puts environment.use_as_skydome? # Outputs true

Parameters:

  • use_as_skydome (Boolean)

    true if the environment should be used as a skydome, false otherwise

Version:

  • SketchUp 2025.0

#use_as_skydome?Boolean (rw)

The #use_as_skydome? method is used to determine if the Environment is used as a skydome.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
puts environment.use_as_skydome? # Outputs false

Returns:

  • (Boolean)

    true

Version:

  • SketchUp 2025.0

#use_for_reflections=(use_for_reflection) (rw)

The #use_for_reflections= method is used to set if the Environment is used for reflections.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
environment.use_for_reflections = true
puts environment.use_for_reflections? # Outputs true

Parameters:

  • use_for_reflection (Boolean)

    true if the environment should be used for reflections, false otherwise

Version:

  • SketchUp 2025.0

#use_for_reflections?Boolean (rw)

The #use_for_reflections? method is used to determine if the Environment is used for reflections.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
puts environment.use_for_reflections? # Outputs false

Returns:

  • (Boolean)

    true if the environment is used for reflections, false otherwise

Version:

  • SketchUp 2025.0

Instance Method Details

#pathString

The #path method is used to get the file name of the image or SKE file used for the Environment.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
puts environment.path # Outputs 'environment.hdr'

Returns:

  • (String)

    the file name of the image or SKE file used for the environment

Version:

  • SketchUp 2025.0

#thumbnailSketchup::ImageRep

The #thumbnail method is used to get the thumbnail image of the Environment.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
thumbnail = environment.thumbnail

Version:

  • SketchUp 2025.0

#write_hdr(path) ⇒ String

The #write_hdr method writes the HDR, EXR or SKE image of the environment to a file in its original file type.

Examples:

model = Sketchup.active_model
environments = model.environments
path = 'path/to/environment.hdr'
environment = environments.add('Example', path)
environment.write_hdr('path/to/directory')

Parameters:

  • path (String)

    the directory where the image should be written

Returns:

  • (String)

    the full path of the written file

Raises:

  • (ArgumentError)

    if the image is invalid.

  • (ArgumentError)

    if the file name is empty.

  • (RuntimeError)

    if the file cannot be written.

Version:

  • SketchUp 2025.0