|
SketchUp C API
|
References a component definition. More...
#include <SketchUpAPI/model/component_definition.h>
Inherits SUEntityRef.
Related Functions | |
(Note that these are not member functions.) | |
| SUEntityRef | SUComponentDefinitionToEntity (SUComponentDefinitionRef comp_def) |
| Converts from an SUComponentDefinitionRef to an SUEntityRef. This is essentially an upcast operation. More... | |
| SUComponentDefinitionRef | SUComponentDefinitionFromEntity (SUEntityRef entity) |
| Converts from an SUEntityRef to an SUComponentDefinitionRef. This is essentially a downcast operation so the given entity must be convertible to an SUComponentDefinitionRef. More... | |
| SUDrawingElementRef | SUComponentDefinitionToDrawingElement (SUComponentDefinitionRef comp_def) |
| Converts from an SUComponentDefinitionRef to an SUDrawingElementRef. This is essentially an upcast operation. More... | |
| SUComponentDefinitionRef | SUComponentDefinitionFromDrawingElement (SUDrawingElementRef drawing_elem) |
| Converts from an SUDrawingElementRef to an SUComponentDefinitionRef. This is essentially a downcast operation so the given element must be convertible to an SUComponentDefinitionRef. More... | |
| enum SUResult | SUComponentDefinitionCreate (SUComponentDefinitionRef *comp_def) |
| Creates a new component definition. The created definition must be released with SUComponentDefinitionRelease(), or attached to either a parent component or parent model. Add the new component definition to model using SUModelAddComponentDefinitions() before making any modifications to it. Once the component definition is owned by a model, use SUModelRemoveComponentDefinitions() to remove it. More... | |
| enum SUResult | SUComponentDefinitionRelease (SUComponentDefinitionRef *comp_def) |
| Releases a component definition object and its associated resources. If the provided definition was contained by a model, use SUModelRemoveComponentDefinitions() to remove the definition and all instances. More... | |
| enum SUResult | SUComponentDefinitionGetName (SUComponentDefinitionRef comp_def, SUStringRef *name) |
| Retrieves the name of a component definition. More... | |
| enum SUResult | SUComponentDefinitionSetName (SUComponentDefinitionRef comp_def, const char *name) |
| Sets the name of a component definition. More... | |
| enum SUResult | SUComponentDefinitionGetGuid (SUComponentDefinitionRef comp_def, SUStringRef *guid_ref) |
| Retrieves the globally unique identifier (guid) string of a component definition. More... | |
| enum SUResult | SUComponentDefinitionGetEntities (SUComponentDefinitionRef comp_def, SUEntitiesRef *entities) |
| Retrieves the entities of the component definition. More... | |
| enum SUResult | SUComponentDefinitionGetControlEntities (SUComponentDefinitionRef comp_def, SUEntitiesRef *entities) |
| Retrieves the control (input) entities of a procedural component definition. More... | |
| enum SUResult | SUComponentDefinitionGetDescription (SUComponentDefinitionRef comp_def, SUStringRef *desc) |
| Retrieves the description of the component definition. More... | |
| enum SUResult | SUComponentDefinitionSetDescription (SUComponentDefinitionRef comp_def, const char *desc) |
| Sets the description of the component definition. More... | |
| enum SUResult | SUComponentDefinitionCreateInstance (SUComponentDefinitionRef comp_def, SUComponentInstanceRef *instance) |
| Create an instance of a component definition. More... | |
| enum SUResult | SUComponentDefinitionGetNumUsedInstances (SUComponentDefinitionRef comp_def, size_t *count) |
| Retrieves the total number of instances of the provided definition. This method takes into account the full hierarchy of the model. Therefore, the count is influenced by adding/removing instances of other definitions which contain an instance of this definition. Users should not use this function to determine the count to be passed to SUComponentDefinitionGetInstances specifying the number of instances to be retrieved. More... | |
| enum SUResult | SUComponentDefinitionGetNumInstances (SUComponentDefinitionRef comp_def, size_t *count) |
| Retrieves the number of unique instances of the provided definition. The returned count represents the number of instances of this definition in the model's root plus the number instances of this definition contained in other definitions. More... | |
| enum SUResult | SUComponentDefinitionGetInstances (SUComponentDefinitionRef comp_def, size_t len, SUComponentInstanceRef instances[], size_t *count) |
| Retrieves the instances of the definition. More... | |
| enum SUResult | SUComponentDefinitionGetBehavior (SUComponentDefinitionRef comp_def, struct SUComponentBehavior *behavior) |
| Retrieves the behavior of a component definition. More... | |
| enum SUResult | SUComponentDefinitionSetBehavior (SUComponentDefinitionRef comp_def, const struct SUComponentBehavior *behavior) |
| Sets the component behavior of a component definition. More... | |
| enum SUResult | SUComponentDefinitionApplySchemaType (SUComponentDefinitionRef comp_def, SUSchemaRef schema_ref, SUSchemaTypeRef schema_type_ref) |
| Applies a schema type from a schema to a component definition. More... | |
| enum SUResult | SUComponentDefinitionIsInternal (SUComponentDefinitionRef comp_def, bool *is_internal) |
| Retrieves a flag indicating whether the component definition was created inside the current SketchUp model or whether it was added from another SKP file. More... | |
| enum SUResult | SUComponentDefinitionGetPath (SUComponentDefinitionRef comp_def, SUStringRef *path) |
| Retrieves the path where the component definition was loaded from. More... | |
| enum SUResult | SUComponentDefinitionGetLoadTime (SUComponentDefinitionRef comp_def, struct tm *load_time) |
| Gets the load time of the component definition. For an internal component definition, this is the time that it was created. For an external component definition, this is the time that it was added to the model. More... | |
| enum SUResult | SUComponentDefinitionGetNumOpenings (SUComponentDefinitionRef comp_def, size_t *count) |
| Retrieves the number of openings from the component definition. More... | |
| enum SUResult | SUComponentDefinitionGetOpenings (SUComponentDefinitionRef comp_def, size_t len, SUOpeningRef openings[], size_t *count) |
| Retrieves the openings from the component definition. The openings retrieved must be released with SUOpeningRelease(). More... | |
| enum SUResult | SUComponentDefinitionGetInsertPoint (SUComponentDefinitionRef comp_def, struct SUPoint3D *point) |
| Retrieves the insertion point from the component definition. More... | |
| enum SUResult | SUComponentDefinitionGetType (SUComponentDefinitionRef comp_def, enum SUComponentType *type) |
| Retrieves the SUComponentType() from the component definition. More... | |
| enum SUResult | SUComponentDefinitionOrientFacesConsistently (SUComponentDefinitionRef comp_def) |
| Updates the faces in the component definition so that they are oriented consistently. More... | |
| enum SUResult | SUComponentDefinitionSetInsertPoint (SUComponentDefinitionRef comp_def, const struct SUPoint3D *point) |
| Sets the insertion point for the component definition. More... | |
| enum SUResult | SUComponentDefinitionSetAxes (SUComponentDefinitionRef comp_def, SUAxesRef axes) |
| Sets the axes of the component definition. More... | |
| enum SUResult | SUComponentDefinitionIsLiveComponent (SUComponentDefinitionRef comp_def, bool *is_live) |
| Retrieves a flag indicating whether the component definition is a Live Component or a sub-definition of a Live Component. More... | |
| enum SUResult | SUComponentDefinitionSaveToFile (SUComponentDefinitionRef comp_def, const char *file_path, enum SUModelVersion version) |
| Saves the component definition to a file. More... | |
| enum SUResult | SUComponentDefinitionIsManifold (SUComponentDefinitionRef comp_def, bool *is_manifold) |
| Retrieves the flag indicating whether the component definition is manifold. More... | |
| enum SUResult | SUComponentDefinitionIsProcedural (SUComponentDefinitionRef comp_def, bool *is_procedural) |
| Retrieves the flag indicating whether the component definition is a procedural component. More... | |
| enum SUResult | SUComponentDefinitionAttachProcedure (SUComponentDefinitionRef comp_def, const char *procedure_id, SUTypedValueMapRef parameters) |
| Attaches a registered procedure to a component definition, making it a procedural component if the procedure is valid for the component's input geometry. More... | |
| enum SUResult | SUComponentDefinitionSetProcedureParameters (SUComponentDefinitionRef comp_def, SUTypedValueMapRef parameters) |
| Sets the parameters for the procedure attached to a procedural component definition. 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... | |
References a component definition.
|
related |
Applies a schema type from a schema to a component definition.
| [in,out] | comp_def | The component definition object. |
| [in] | schema_ref | The schema that owns the schema type to apply. |
| [in] | schema_type_ref | The schema type to apply. |
|
related |
Attaches a registered procedure to a component definition, making it a procedural component if the procedure is valid for the component's input geometry.
The definition must not already be procedural. Attaching a procedure to a definition that already has one is not supported.
The supplied parameter values must be of one of the following types: SUTypedValueType_Bool, SUTypedValueType_Int32, SUTypedValueType_Double, or SUTypedValueType_String. Other value types will cause this function to fail with SU_ERROR_INVALID_ARGUMENT.
| [in] | comp_def | The component definition object. |
| [in] | procedure_id | The id of the procedure to attach. |
| [in] | parameters | The procedure parameters as a typed value map. Pass an empty map if the procedure does not require parameters. Keys must match the parameter ids declared by the procedure. |
comp_def or parameters is invalidprocedure_id is NULLcomp_def is a group or image definition, or if any value in parameters has an unsupported typeprocedure_id does not refer to a registered procedurecomp_def is already procedural, or if the procedure cannot be attached to this definition, most likely because the input geometry is invalid for the procedure
|
related |
Creates a new component definition. The created definition must be released with SUComponentDefinitionRelease(), or attached to either a parent component or parent model. Add the new component definition to model using SUModelAddComponentDefinitions() before making any modifications to it. Once the component definition is owned by a model, use SUModelRemoveComponentDefinitions() to remove it.
| [out] | comp_def | The component object created. |
|
related |
Create an instance of a component definition.
| [in] | comp_def | The component definition object. |
| [out] | instance | The instance created. |
|
related |
Converts from an SUDrawingElementRef to an SUComponentDefinitionRef. This is essentially a downcast operation so the given element must be convertible to an SUComponentDefinitionRef.
| [in] | drawing_elem | The given element reference. |
|
related |
Converts from an SUEntityRef to an SUComponentDefinitionRef. This is essentially a downcast operation so the given entity must be convertible to an SUComponentDefinitionRef.
| [in] | entity | The given entity reference. |
|
related |
Retrieves the behavior of a component definition.
| [in] | comp_def | The component definition object. |
| [out] | behavior | The behavior retrieved. |
|
related |
Retrieves the control (input) entities of a procedural component definition.
The control entities are the geometry that drives the procedural output. To retrieve the procedural output instead, use SUComponentDefinitionGetEntities().
| [in] | comp_def | The component definition object. |
| [out] | entities | The control entities retrieved. |
|
related |
Retrieves the description of the component definition.
| [in] | comp_def | The component definition object. |
| [out] | desc | The description retrieved. |
|
related |
Retrieves the entities of the component definition.
For a procedural component definition, the entities retrieved are the procedural output. To retrieve the control entities that drive that output instead, use SUComponentDefinitionGetControlEntities().
| [in,out] | comp_def | The component definition object. |
| [out] | entities | The entities retrieved. |
|
related |
Retrieves the globally unique identifier (guid) string of a component definition.
| [in] | comp_def | The component definition object. |
| [out] | guid_ref | The guid retrieved. |
|
related |
Retrieves the insertion point from the component definition.
[0, 0, 0], as the insertion point can no longer be changed.| [in] | comp_def | The component definition object. |
| [out] | point | The insertion point retrieved. |
|
related |
Retrieves the instances of the definition.
| [in] | comp_def | The component definition object. |
| [in] | len | The number of component instances to retrieve. |
| [out] | instances | The component instances retrieved. |
| [out] | count | The number of component instances retrieved. |
|
related |
Gets the load time of the component definition. For an internal component definition, this is the time that it was created. For an external component definition, this is the time that it was added to the model.
| [in] | comp_def | The component definition object. |
| [out] | load_time | The time value retrieved. |
|
related |
Retrieves the name of a component definition.
| [in] | comp_def | The component definition object. |
| [out] | name | The name retrieved. |
|
related |
Retrieves the number of unique instances of the provided definition. The returned count represents the number of instances of this definition in the model's root plus the number instances of this definition contained in other definitions.
| [in] | comp_def | The component definition object. |
| [out] | count | The number of instances of the definition. |
|
related |
Retrieves the number of openings from the component definition.
| [in] | comp_def | The component definition object. |
| [out] | count | The number of openings. |
|
related |
Retrieves the total number of instances of the provided definition. This method takes into account the full hierarchy of the model. Therefore, the count is influenced by adding/removing instances of other definitions which contain an instance of this definition. Users should not use this function to determine the count to be passed to SUComponentDefinitionGetInstances specifying the number of instances to be retrieved.
| [in] | comp_def | The component definition object. |
| [out] | count | The number of instances of the definition. |
|
related |
Retrieves the openings from the component definition. The openings retrieved must be released with SUOpeningRelease().
| [in] | comp_def | The component definition object. |
| [in] | len | The number of openings to retrieve. |
| [out] | openings | The SUOpeningRef objects retrieved. |
| [out] | count | The number of openings retrieved. |
|
related |
Retrieves the path where the component definition was loaded from.
| [in] | comp_def | The component definition object. |
| [out] | path | A valid path if successful. |
|
related |
Retrieves the SUComponentType() from the component definition.
| [in] | comp_def | The component definition object. |
| [out] | type | The SUComponentType() retrieved. |
|
related |
Retrieves a flag indicating whether the component definition was created inside the current SketchUp model or whether it was added from another SKP file.
| [in] | comp_def | The component definition object. |
| [out] | is_internal | The bool value retrieved. |
|
related |
Retrieves a flag indicating whether the component definition is a Live Component or a sub-definition of a Live Component.
| [in] | comp_def | The component definition object. |
| [out] | is_live | The bool value retrieved. |
comp_def is invalidis_live is NULL
|
related |
Retrieves the flag indicating whether the component definition is manifold.
| [in] | comp_def | The component definition object. |
| [out] | is_manifold | The bool value retrieved. |
comp_def is invalidis_manifold is NULL
|
related |
Retrieves the flag indicating whether the component definition is a procedural component.
| [in] | comp_def | The component definition object. |
| [out] | is_procedural | The bool value retrieved. |
comp_def is invalidis_procedural is NULL
|
related |
Updates the faces in the component definition so that they are oriented consistently.
| [in,out] | comp_def | The component definition object. |
|
related |
Releases a component definition object and its associated resources. If the provided definition was contained by a model, use SUModelRemoveComponentDefinitions() to remove the definition and all instances.
| [in,out] | comp_def | The component definition object. |
|
related |
Saves the component definition to a file.
| [in] | comp_def | The component definition object. |
| [in] | file_path | The file path destination of the serialization operation. Assumed to be UTF-8 encoded. |
| [in] | version | The SKP file format version to use when saving. Use SUModelVersion_Current for the current version. |
comp_def is not a valid objectcomp_def is not owned by a modelversion is invalidfile_path is NULL
|
related |
Sets the axes of the component definition.
| [in,out] | comp_def | The component definition object. |
| [in] | axes | The SUAxesRef to use. |
|
related |
Sets the component behavior of a component definition.
| [in,out] | comp_def | The component definition object. |
| [in] | behavior | The behavior to set. |
|
related |
Sets the description of the component definition.
| [in,out] | comp_def | The component definition object. |
| [in] | desc | The description to be set. Assumed to be UTF-8 encoded. |
|
related |
Sets the insertion point for the component definition.
| [in,out] | comp_def | The component definition object. |
| [in] | point | The SUPoint3D to use. |
|
related |
Sets the name of a component definition.
| [in,out] | comp_def | The component definition object. |
| [in] | name | The name of the component definition. Assumed to be UTF-8 encoded. If the requested name already belongs to another definition in the model, a unique name will be generated based on this name. |
comp_def is invalidname is NULL
|
related |
Sets the parameters for the procedure attached to a procedural component definition.
The component's output geometry will be regenerated with the new parameters.
The supplied parameter values must be of one of the following types: SUTypedValueType_Bool, SUTypedValueType_Int32, SUTypedValueType_Double, or SUTypedValueType_String. Other value types will cause this function to fail with SU_ERROR_INVALID_ARGUMENT.
| [in] | comp_def | The component definition object. |
| [in] | parameters | The procedure parameters as a typed value map. Keys must match the parameter ids declared by the procedure. |
comp_def or parameters is invalidcomp_def is not a procedural component, or if any value in parameters has an unsupported type
|
related |
Converts from an SUComponentDefinitionRef to an SUDrawingElementRef. This is essentially an upcast operation.
| [in] | comp_def | The given component definition reference. |
|
related |
Converts from an SUComponentDefinitionRef to an SUEntityRef. This is essentially an upcast operation.
| [in] | comp_def | The given component definition reference. |
1.8.3.1