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
SULayerRef Struct Reference

References a Tag object. More...

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

Inherits SUEntityRef.

## Related Functions
(Note that these are not member functions.)
SUEntityRef | SULayerToEntity (SULayerRef layer)
| Converts from an SULayerRef to an SUEntityRef. This is essentially an upcast operation. More...
SULayerRef | SULayerFromEntity (SUEntityRef entity)
| Converts from an SUEntityRef to an SULayerRef. This is essentially a downcast operation so the given SUEntityRef must be convertible to an SULayerRef. More...
enum SUResult | SULayerCreate (SULayerRef *layer)
| Creates a new layer object. More...
enum SUResult | SULayerRelease (SULayerRef *layer)
| Deallocates a layer object. More...
enum SUResult | SULayerGetName (SULayerRef layer, SUStringRef *name)
| Retrieves the name of a layer object. More...
enum SUResult | SULayerGetDisplayName (SULayerRef layer, SUStringRef *name)
| Retrieves the display name of a layer object. More...
enum SUResult | SULayerSetName (SULayerRef layer, const char *name)
| Assigns the name of a layer object. More...
enum SUResult | SULayerGetMaterial (SULayerRef layer, SUMaterialRef *material)
| Retrieves the material object associated with a layer object. More...
enum SUResult | SULayerGetVisibility (SULayerRef layer, bool *visible)
| Retrieves the boolean flag indicating whether a layer object is visible. More...
enum SUResult | SULayerSetVisibility (SULayerRef layer, bool visible)
| Sets the boolean flag indicating whether a layer object is visible. More...
enum SUResult | SULayerGetLineStyle (SULayerRef layer, SULineStyleRef *line_style)
| Get the line style of a layer. More...
enum SUResult | SULayerSetLineStyle (SULayerRef layer, SULineStyleRef line_style)
| Set the line style of a layer. More...
enum SUResult | SULayerClearLineStyle (SULayerRef layer)
| Clear the line style of a layer. More...
enum SUResult | SULayerGetSceneBehavior (SULayerRef layer, enum SULayerVisibilityDefaultType *default_type, enum SULayerVisibilityNewSceneType *new_scene_type)
| Get the scene behavior on the layer. More...
enum SUResult | SULayerSetSceneBehavior (SULayerRef layer, enum SULayerVisibilityDefaultType default_type, enum SULayerVisibilityNewSceneType new_scene_type)
| Set the scene behavior on the layer. More...
enum SUResult | SULayerGetParentLayerFolder (SULayerRef layer, SULayerFolderRef *layer_folder)
| Gets the SULayerFolderRef object that contains the given layer. More...
Related Functions inherited from SUEntityRef
enum SURefType | SUEntityGetType (SUEntityRef entity)
| Returns the concrete type of the given entity. More...
enum SUResult | SUEntityGetID (SUEntityRef entity, int32_t *entity_id)
| Retrieves the id of the entity. More...
enum SUResult | SUEntityGetPersistentID (SUEntityRef entity, int64_t *entity_pid)
| Retrieves the persistent id of the entity. More...
enum SUResult | SUEntityGetNumAttributeDictionaries (SUEntityRef entity, size_t *count)
| Retrieves the number of attribute dictionaries of an entity. More...
enum SUResult | SUEntityGetAttributeDictionaries (SUEntityRef entity, size_t len, SUAttributeDictionaryRef dictionaries[], size_t *count)
| Retrieves the attribute dictionaries of an entity. More...
enum SUResult | SUEntityAddAttributeDictionary (SUEntityRef entity, SUAttributeDictionaryRef dictionary)
| Adds the attribute dictionary to an entity. The given dictionary object must not belong to another entity. In other words, each dictionary should be added to one entity only. More...
enum SUResult | SUEntityGetAttributeDictionary (SUEntityRef entity, const char *name, SUAttributeDictionaryRef *dictionary)
| Retrieves the attribute dictionary of an entity that has the given name. More...
enum SUResult | SUEntityGetModel (SUEntityRef entity, SUModelRef *model)
| Retrieves the model object associated with the entity. More...
enum SUResult | SUEntityGetParentEntities (SUEntityRef entity, SUEntitiesRef *entities)
| Retrieves the entities object which contains the entity. More...

## Detailed Description

References a Tag object.

Note
  'Layer' is a legacy term that is being used for consistency within the API.

## Friends And Related Function Documentation

enum SUResult SULayerClearLineStyle | ( | SULayerRef | layer | ) |
| related

Clear the line style of a layer.

Since
  SketchUp 2019, API 7.0

Parameters

  [in] | layer | The layer object.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if layer is not a valid object.

enum SUResult SULayerCreate | ( | SULayerRef * | layer | ) |
| related

Creates a new layer object.

Layers associated with a SketchUp model must not be explicitly deallocated. Layers that are not associated with a SketchUp model must be deallocated with SULayerRelease().

Parameters

  [out] | layer | The layer object created.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_OUTPUT if layer is NULL

SULayerRef SULayerFromEntity | ( | SUEntityRef | entity | ) |
| related

Converts from an SUEntityRef to an SULayerRef. This is essentially a downcast operation so the given SUEntityRef must be convertible to an SULayerRef.

Parameters

  [in] | entity | The given entity reference.

Returns
  - The converted SULayerRef if the downcast operation succeeds
  - If not, the returned reference will be invalid

enum SUResult SULayerGetDisplayName | ( | SULayerRef | layer,
|  | SUStringRef * | name
| ) |  |
| related

Retrieves the display name of a layer object.

Since
  SketchUp 2020.0, API version 8.0

The display name is the name you see in the product. In SketchUp 2020 the display name for the default layer changed from "Layer0" to "Untagged". For all other layers the name and display name are identical.

Parameters

  [in] | layer | The layer object.
  [out] | name | The display name retrieved.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if layer is not a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if name is NULL
  - SU_ERROR_INVALID_OUTPUT if name does not point to a valid SUStringRef object

enum SUResult SULayerGetLineStyle | ( | SULayerRef | layer,
|  | SULineStyleRef * | line_style
| ) |  |
| related

Get the line style of a layer.

Since
  SketchUp 2019, API 7.0

Parameters

  [in] | layer | The layer object.
  [out] | line_style | The line style reference.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if layer is not a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if line_style is NULL
  - SU_ERROR_NO_DATA if the layer has no custom line style.

enum SUResult SULayerGetMaterial | ( | SULayerRef | layer,
|  | SUMaterialRef * | material
| ) |  |
| related

Retrieves the material object associated with a layer object.

The retrieved material object must not be deallocated by the caller since it is owned by the layer object.

Parameters

  [in] | layer | The layer object.
  [out] | material | The material object retrieved.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if layer is not a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if material is NULL

enum SUResult SULayerGetName | ( | SULayerRef | layer,
|  | SUStringRef * | name
| ) |  |
| related

Retrieves the name of a layer object.

Parameters

  [in] | layer | The layer object.
  [out] | name | The name retrieved.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if layer is not a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if name is NULL
  - SU_ERROR_INVALID_OUTPUT if name does not point to a valid SUStringRef object

enum SUResult SULayerGetParentLayerFolder | ( | SULayerRef | layer,
|  | SULayerFolderRef * | layer_folder
| ) |  |
| related

Gets the SULayerFolderRef object that contains the given layer.

Since
  SketchUp 2020.2, API 8.2

Parameters

  [in] | layer | The layer object.
  [out] | layer_folder | The retrieved layer folder object.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if `layer` is not a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if `layer_folder` is NULL
  - SU_ERROR_NO_DATA if `layer` is not contained within a layer folder

enum SUResult SULayerGetSceneBehavior | ( | SULayerRef | layer,
|  | enum SULayerVisibilityDefaultType * | default_type,
|  | enum SULayerVisibilityNewSceneType * | new_scene_type
| ) |  |
| related

Get the scene behavior on the layer.

Since
  SketchUp 2020.0, API 8.0

Parameters

  [in] | layer | The layer object.
  [out] | default_type | The retrieved default scene behavior.
  [out] | new_scene_type | The retrieved behavior for new scenes.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if the layer is not a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if default_type or new_scene_type is NULL

enum SUResult SULayerGetVisibility | ( | SULayerRef | layer,
|  | bool * | visible
| ) |  |
| related

Retrieves the boolean flag indicating whether a layer object is visible.

Parameters

  [in] | layer | The layer object.
  [out] | visible | The visibility flag retrieved.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if layer is not a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if visibility is NULL

enum SUResult SULayerRelease | ( | SULayerRef * | layer | ) |
| related

Deallocates a layer object.

The layer object to be deallocated must not be associated with a SketchUp model.

Parameters

  [in,out] | layer | The layer object.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if layer points to an invalid object
  - SU_ERROR_NULL_POINTER_INPUT if layer is NULL

enum SUResult SULayerSetLineStyle | ( | SULayerRef | layer,
|  | SULineStyleRef | line_style
| ) |  |
| related

Set the line style of a layer.

Since
  SketchUp 2019, API 7.0

Parameters

  [in] | layer | The layer object.
  [in] | line_style | The line style to set.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if layer or line_style is not a valid object.

enum SUResult SULayerSetName | ( | SULayerRef | layer,
|  | const char * | name
| ) |  |
| related

Assigns the name of a layer object.

Parameters

  [in] | layer | The layer object.
  [in] | name | The new name of the layer object. Assumed to be UTF-8 encoded.

Returns
  - SU_ERROR_NONE if layer is not a valid object
  - SU_ERROR_NULL_POINTER_INPUT if name is NULL

enum SUResult SULayerSetSceneBehavior | ( | SULayerRef | layer,
|  | enum SULayerVisibilityDefaultType | default_type,
|  | enum SULayerVisibilityNewSceneType | new_scene_type
| ) |  |
| related

Set the scene behavior on the layer.

Since
  SketchUp 2020.0, API 8.0

Parameters

  [in] | layer | The layer object.
  [in] | default_type | The default scene behavior.
  [in] | new_scene_type | The behavior to set for new scenes.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if the layer is not a valid object

enum SUResult SULayerSetVisibility | ( | SULayerRef | layer,
|  | bool | visible
| ) |  |
| related

Sets the boolean flag indicating whether a layer object is visible.

Parameters

  [in] | layer | The layer object.
  [in] | visible | The visibility flag to set.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if layer is not a valid object.

SUEntityRef SULayerToEntity | ( | SULayerRef | layer | ) |
| related

Converts from an SULayerRef to an SUEntityRef. This is essentially an upcast operation.

Parameters

  [in] | layer | The given layer reference.

Returns
  - The converted SUEntityRef if layer is a valid layer
  - If not, the returned reference will be invalid

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

- SketchUpAPI/model/defs.h
- SketchUpAPI/model/layer.h