SketchUp SDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions
component_instance.h File Reference
#include <slapi/slapi.h>
#include <slapi/unicodestring.h>
#include <slapi/transformation.h>
#include <slapi/model/defs.h>

Go to the source code of this file.

Functions

SU_EXPORT SUEntityRef SUComponentInstanceToEntity (SUComponentInstanceRef instance)
 Converts from an SUComponentInstanceRef to an SUEntityRef. This is essentially an upcast operation. More...
 
SU_EXPORT SUComponentInstanceRef SUComponentInstanceFromEntity (SUEntityRef entity)
 Converts from an SUEntityRef to an SUComponentInstanceRef. This is essentially a downcast operation so the given entity must be convertible to a component instance. More...
 
SU_EXPORT SUDrawingElementRef SUComponentInstanceToDrawingElement (SUComponentInstanceRef instance)
 Converts from an SUComponentInstanceRef to an SUDrawingElementRef. This is essentially an upcast operation. More...
 
SU_EXPORT SUComponentInstanceRef SUComponentInstanceFromDrawingElement (SUDrawingElementRef drawing_elem)
 Converts from an SUDrawingElementRef to an SUComponentInstanceRef. This is essentially a downcast operation so the given element must be convertible to a component instance. More...
 
SU_RESULT SUComponentInstanceSetName (SUComponentInstanceRef instance, const char *name)
 Sets the name of a component instance object. More...
 
SU_RESULT SUComponentInstanceRelease (SUComponentInstanceRef *instance)
 Deallocates a component instance object created with SUComponentDefinitionCreateInstance. More...
 
SU_RESULT SUComponentInstanceGetName (SUComponentInstanceRef instance, SUStringRef *name)
 Retrieves the name of a component instance object. More...
 
SU_RESULT SUComponentInstanceSetTransform (SUComponentInstanceRef instance, const struct SUTransformation *transform)
 Sets the transform of a component instance object. More...
 
SU_RESULT SUComponentInstanceGetTransform (SUComponentInstanceRef instance, struct SUTransformation *transform)
 Retrieves the transform of a component instance object. More...
 
SU_RESULT SUComponentInstanceGetDefinition (SUComponentInstanceRef instance, SUComponentDefinitionRef *component)
 Retrieves the component definition of a component instance object. More...
 

Function Documentation

SU_EXPORT SUComponentInstanceRef SUComponentInstanceFromDrawingElement ( SUDrawingElementRef  drawing_elem)

Converts from an SUDrawingElementRef to an SUComponentInstanceRef. This is essentially a downcast operation so the given element must be convertible to a component instance.

Parameters
[in]drawing_elemThe given drawing element reference.
Returns
  • The converted SUComponentInstanceRef if the downcast operation succeeds
  • If not, the returned reference will be invalid
SU_EXPORT SUComponentInstanceRef SUComponentInstanceFromEntity ( SUEntityRef  entity)

Converts from an SUEntityRef to an SUComponentInstanceRef. This is essentially a downcast operation so the given entity must be convertible to a component instance.

Parameters
[in]entityThe given entity reference.
Returns
  • The converted SUComponentInstanceRef if the downcast operation succeeds
  • If not, the returned reference will be invalid
SU_RESULT SUComponentInstanceGetDefinition ( SUComponentInstanceRef  instance,
SUComponentDefinitionRef component 
)

Retrieves the component definition of a component instance object.

Parameters
[in]instanceThe component instance object.
[out]componentThe component definition retrieved.
Returns
SU_RESULT SUComponentInstanceGetName ( SUComponentInstanceRef  instance,
SUStringRef name 
)

Retrieves the name of a component instance object.

Parameters
[in]instanceThe component instance object.
[out]nameThe name retrieved.
Returns
SU_RESULT SUComponentInstanceGetTransform ( SUComponentInstanceRef  instance,
struct SUTransformation transform 
)

Retrieves the transform of a component instance object.

See description of SUComponentInstanceSetTransform for a discussion of component instance transforms.

Parameters
[in]instanceThe component instance object.
[out]transformThe transform retrieved.
Returns
SU_RESULT SUComponentInstanceRelease ( SUComponentInstanceRef instance)

Deallocates a component instance object created with SUComponentDefinitionCreateInstance.

The instance object must not be associated with a parent object. That is, if SUEntitiesAddInstance is called with the instance object, then the instance object must not be released explicitly.

Parameters
[in]instanceThe component instance object.
Returns
SU_RESULT SUComponentInstanceSetName ( SUComponentInstanceRef  instance,
const char *  name 
)

Sets the name of a component instance object.

Parameters
[in]instanceThe component instance object.
[in]nameThe name string to set the component instance object. Assumed to be UTF-8 encoded.
Returns
SU_RESULT SUComponentInstanceSetTransform ( SUComponentInstanceRef  instance,
const struct SUTransformation transform 
)

Sets the transform of a component instance object.

The transform is relative to the parent component. If the parent component is the root component of a model, then the transform is relative to absolute coordinates.

Parameters
[in]instanceThe component instance object.
[in]transformThe affine transform to set.
Returns
SU_EXPORT SUDrawingElementRef SUComponentInstanceToDrawingElement ( SUComponentInstanceRef  instance)

Converts from an SUComponentInstanceRef to an SUDrawingElementRef. This is essentially an upcast operation.

Parameters
[in]instanceThe given component instance reference.
Returns
  • The converted SUEntityRef if instance is a valid component instance
  • If not, the returned reference will be invalid
SU_EXPORT SUEntityRef SUComponentInstanceToEntity ( SUComponentInstanceRef  instance)

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

Parameters
[in]instanceThe given component instance reference.
Returns
  • The converted SUEntityRef if instance is a valid component instance
  • If not, the returned reference will be invalid