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

A dictionary type with SUStringRef objects as keys and SUTypedValueRef objects as values. More...

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

Inherits SUEntityRef.

## Related Functions
(Note that these are not member functions.)
enum SUResult | SUAttributeDictionaryCreate (SUAttributeDictionaryRef *dictionary, const char *name)
| Creates an attributes dictionary object. More...
enum SUResult | SUAttributeDictionaryRelease (SUAttributeDictionaryRef *dictionary)
| Releases an attributes dictionary object and its associated attributes. If this dictionary has a parent, it will be removed from it. More...
SUEntityRef | SUAttributeDictionaryToEntity (SUAttributeDictionaryRef dictionary)
| Converts from an SUAttributeDictionaryRef to an SUEntityRef. This is essentially an upcast operation. More...
SUAttributeDictionaryRef | SUAttributeDictionaryFromEntity (SUEntityRef entity)
| Converts from an SUEntityRef to an SUAttributeDictionaryRef. This is essentially a downcast operation so the given SUEntityRef must be convertible to an SUAttributeDictionaryRef. More...
enum SUResult | SUAttributeDictionaryGetName (SUAttributeDictionaryRef dictionary, SUStringRef *name)
| Retrieves the name of an attribute dictionary object. More...
enum SUResult | SUAttributeDictionarySetValue (SUAttributeDictionaryRef dictionary, const char *key, SUTypedValueRef value_in)
| Inserts a key-value pair into an attribute dictionary object. More...
enum SUResult | SUAttributeDictionaryGetValue (SUAttributeDictionaryRef dictionary, const char *key, SUTypedValueRef *value_out)
| Retrieves the value associated with a given key from an attribute dictionary. More...
enum SUResult | SUAttributeDictionaryGetNumKeys (SUAttributeDictionaryRef dictionary, size_t *count)
| Retrieves the number of keys in an attribute dictionary object. More...
enum SUResult | SUAttributeDictionaryGetKeys (SUAttributeDictionaryRef dictionary, size_t len, SUStringRef keys[], size_t *count)
| Retrieves the array of keys of an attribute dictionary object. 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

A dictionary type with SUStringRef objects as keys and SUTypedValueRef objects as values.

## Friends And Related Function Documentation

enum SUResult SUAttributeDictionaryCreate | ( | SUAttributeDictionaryRef * | dictionary,
|  | const char * | name
| ) |  |
| related

Creates an attributes dictionary object.

Since
  SketchUp 2018 M0, API 6.0

Parameters

  [out] | dictionary | The attributes dictionary object created.
  [in] | name | The name of the attribute dictionary. Assumed to be UTF-8 encoded.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_INPUT if name is NULL
  - SU_ERROR_NULL_POINTER_OUTPUT if dictionary is NULL
  - SU_ERROR_OVERWRITE_VALID if dictionary already references a valid object

SUAttributeDictionaryRef SUAttributeDictionaryFromEntity | ( | SUEntityRef | entity | ) |
| related

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

Since
  SketchUp 2014, API 2.0

Parameters

  [in] | entity | The given entity reference.

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

enum SUResult SUAttributeDictionaryGetKeys | ( | SUAttributeDictionaryRef | dictionary,
|  | size_t | len,
|  | SUStringRef | keys[],
|  | size_t * | count
| ) |  |
| related

Retrieves the array of keys of an attribute dictionary object.

Parameters

  [in] | dictionary | The attribute dictionary object.
  [in] | len | The number of keys to retrieve.
  [out] | keys | The keys retrieved.
  [out] | count | The number of keys retrieved.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if dictionary is an invalid object
  - SU_ERROR_NULL_POINTER_OUTPUT if keys or count is NULL

enum SUResult SUAttributeDictionaryGetName | ( | SUAttributeDictionaryRef | dictionary,
|  | SUStringRef * | name
| ) |  |
| related

Retrieves the name of an attribute dictionary object.

Parameters

  [in] | dictionary | The attribute dictionary object.
  [out] | name | The name retrieved.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if dictionary is an invalid 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 SUAttributeDictionaryGetNumKeys | ( | SUAttributeDictionaryRef | dictionary,
|  | size_t * | count
| ) |  |
| related

Retrieves the number of keys in an attribute dictionary object.

Parameters

  [in] | dictionary | The attribute dictionary object.
  [out] | count | The number of keys.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if dictionary is an invalid object
  - SU_ERROR_NULL_POINTER_OUTPUT if count is NULL

enum SUResult SUAttributeDictionaryGetValue | ( | SUAttributeDictionaryRef | dictionary,
|  | const char * | key,
|  | SUTypedValueRef * | value_out
| ) |  |
| related

Retrieves the value associated with a given key from an attribute dictionary.

Parameters

  [in] | dictionary | The attribute dictionary object.
  [in] | key | The key of the key-value pair. Assumed to be UTF-8 encoded.
  [out] | value_out | The value retrieved. Must be a valid object, i.e. must have been allocated via SUTypedValueCreate().

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if dictionary is an invalid object
  - SU_ERROR_NULL_POINTER_INPUT if key is NULL
  - SU_ERROR_NULL_POINTER_OUTPUT if value_out is NULL
  - SU_ERROR_INVALID_OUTPUT if value_out is an invalid object
  - SU_ERROR_NO_DATA if there is no value associated with the given key in the dictionary

enum SUResult SUAttributeDictionaryRelease | ( | SUAttributeDictionaryRef * | dictionary | ) |
| related

Releases an attributes dictionary object and its associated attributes. If this dictionary has a parent, it will be removed from it.

Since
  SketchUp 2018 M0, API 6.0

Parameters

  [in,out] | dictionary | The attributes dictionary object.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_INPUT if dictionary is NULL
  - SU_ERROR_INVALID_INPUT if dictionary does not reference a valid object

enum SUResult SUAttributeDictionarySetValue | ( | SUAttributeDictionaryRef | dictionary,
|  | const char * | key,
|  | SUTypedValueRef | value_in
| ) |  |
| related

Inserts a key-value pair into an attribute dictionary object.

Parameters

  [in,out] | dictionary | The attribute dictionary object.
  [in] | key | The key of the key-value pair. Assumed to be UTF-8 encoded.
  [in] | value_in | The value of the key-value pair.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if dictionary or value_in is an invalid object.
  - SU_ERROR_NULL_POINTER_INPUT if key is NULL
  - SU_ERROR_INVALID_OPERATION if dictionary is read-only.

SUEntityRef SUAttributeDictionaryToEntity | ( | SUAttributeDictionaryRef | dictionary | ) |
| related

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

Since
  SketchUp 2014, API 2.0

Parameters

  [in] | dictionary | The attribute dictionary object.

Returns
  - The converted SUEntityRef if dictionary is a valid object
  - 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/attribute_dictionary.h