SketchUp C API

- Main Page
- Related Pages
- Data Structures
- Files

- Data Structures
- Data Structure Index
- Class Hierarchy
- Data Fields

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Related Functions
SUEnvironmentsRef Struct Reference

References a container object for all environments in a model. More...

`#include <SketchUpAPI/model/environments.h>`

## Related Functions
(Note that these are not member functions.)
enum SUResult | SUEnvironmentsGetCount (SUEnvironmentsRef environments, size_t *count)
| Retrieves the number of environment objects in an environments object. More...
enum SUResult | SUEnvironmentsGetAll (SUEnvironmentsRef environments, size_t len, SUEnvironmentRef items[], size_t *count)
| Retrieves every environment associated with an environments object. More...
enum SUResult | SUEnvironmentsGetSelectedEnvironment (SUEnvironmentsRef environments, SUEnvironmentRef *environment)
| Retrieves the currently selected environment. More...
enum SUResult | SUEnvironmentsGetEnvironmentByPersistentID (SUEnvironmentsRef environments, uint64_t pid, SUEnvironmentRef *environment)
| Retrieves an environment by persistent ID. More...
enum SUResult | SUEnvironmentsGetEnvironmentByName (SUEnvironmentsRef environments, const char *name, SUEnvironmentRef *environment)
| Retrieves an environment by name. More...
enum SUResult | SUEnvironmentsAdd (SUEnvironmentsRef environments, SUEnvironmentRef environment)
| Adds an environment to an environments object. More...
enum SUResult | SUEnvironmentsRemove (SUEnvironmentsRef environments, SUEnvironmentRef environment)
| Removes an environment from an environments object. More...

## Detailed Description

References a container object for all environments in a model.

Since
  SketchUp 2025.0, API 13.0

## Friends And Related Function Documentation

enum SUResult SUEnvironmentsAdd | ( | SUEnvironmentsRef | environments,
|  | SUEnvironmentRef | environment
| ) |  |
| related

Adds an environment to an environments object.

Note
  This method transfers ownership of the `environment` to the model. Do not call `SUEnvironmentRelease` on `environment` after calling this method.

Since
  SketchUp 2025.0, API 13.0

Parameters

  [in] | environments | The environments object.
  [in] | environment | The environment object to add.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if `environment` or `environments` is not a valid object
  - SU_ERROR_DUPLICATE if the `environment` is already part of the environments object
  - SU_ERROR_INVALID_ARGUMENT if the environment name is already in use

enum SUResult SUEnvironmentsGetAll | ( | SUEnvironmentsRef | environments,
|  | size_t | len,
|  | SUEnvironmentRef | items[],
|  | size_t * | count
| ) |  |
| related

Retrieves every environment associated with an environments object.

Since
  SketchUp 2025.0, API 13.0

Parameters

  [in] | environments | The environments object.
  [in] | len | The number of environments to retrieve.
  [out] | items | The environments retrieved.
  [out] | count | The number of environments retrieved.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if `environments` is not a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if `items` or `count` is `NULL`

enum SUResult SUEnvironmentsGetCount | ( | SUEnvironmentsRef | environments,
|  | size_t * | count
| ) |  |
| related

Retrieves the number of environment objects in an environments object.

Since
  SketchUp 2025.0, API 13.0

Parameters

  [in] | environments | The environments object.
  [out] | count | The number of environments.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if `environments` is not a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if `count` is `NULL`

enum SUResult SUEnvironmentsGetEnvironmentByName | ( | SUEnvironmentsRef | environments,
|  | const char * | name,
|  | SUEnvironmentRef * | environment
| ) |  |
| related

Retrieves an environment by name.

Since
  SketchUp 2025.0, API 13.0

Parameters

  [in] | environments | The environments object.
  [in] | name | The name of the environment object to retrieve.
  [out] | environment | The environment object with the given name.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if `environments` is not a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if `environment` is `NULL`
  - SU_ERROR_NO_DATA if no environment can be found with the given name

enum SUResult SUEnvironmentsGetEnvironmentByPersistentID | ( | SUEnvironmentsRef | environments,
|  | uint64_t | pid,
|  | SUEnvironmentRef * | environment
| ) |  |
| related

Retrieves an environment by persistent ID.

Since
  SketchUp 2025.0, API 13.0

Parameters

  [in] | environments | The environments object.
  [in] | pid | The PID of the environment object to retrieve.
  [out] | environment | The environment object with the given PID.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if `environments` is not a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if `environment` is `NULL`
  - SU_ERROR_NO_DATA if no environment can be found with the given PID

enum SUResult SUEnvironmentsGetSelectedEnvironment | ( | SUEnvironmentsRef | environments,
|  | SUEnvironmentRef * | environment
| ) |  |
| related

Retrieves the currently selected environment.

Since
  SketchUp 2025.0, API 13.0

Parameters

  [in] | environments | The environments object.
  [out] | environment | The selected environment object.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if `environments` is not a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if `environment` is `NULL`
  - SU_ERROR_NO_DATA if no environment is currently selected

enum SUResult SUEnvironmentsRemove | ( | SUEnvironmentsRef | environments,
|  | SUEnvironmentRef | environment
| ) |  |
| related

Removes an environment from an environments object.

Since
  SketchUp 2025.0, API 13.0

Parameters

  [in] | environments | The environments object.
  [in] | environment | The environment object to remove.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if `environment` or `environments` is not a valid object
  - SU_ERROR_INVALID_OPERATION if `environment` is not part of the `environments` object

The documentation for this struct was generated from the following files:

- SketchUpAPI/model/defs.h
- SketchUpAPI/model/environments.h