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

Go to the source code of this file.

Data Structures

struct  SUComponentBehavior
 Describes how the component behaves in the SketchUp rendering scene. More...
 

Functions

SU_EXPORT SUEntityRef SUComponentDefinitionToEntity (SUComponentDefinitionRef comp_def)
 Converts from an SUComponentDefinitionRef to an SUEntityRef. This is essentially an upcast operation. More...
 
SU_EXPORT 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...
 
SU_EXPORT SUDrawingElementRef SUComponentDefinitionToDrawingElement (SUComponentDefinitionRef comp_def)
 Converts from an SUComponentDefinitionRef to an SUDrawingElementRef. This is essentially an upcast operation. More...
 
SU_EXPORT 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...
 
SU_RESULT SUComponentDefinitionCreate (SUComponentDefinitionRef *comp_def)
 Creates a new component definition. More...
 
SU_RESULT SUComponentDefinitionRelease (SUComponentDefinitionRef *comp_def)
 Releases a component definition object and its associated resources. The object must not be associated with a parent component or model. More...
 
SU_RESULT SUComponentDefinitionGetName (SUComponentDefinitionRef comp_def, SUStringRef *name)
 Retrieves the name of a component definition. More...
 
SU_RESULT SUComponentDefinitionSetName (SUComponentDefinitionRef comp_def, const char *name)
 Sets the name of a component definition. More...
 
SU_RESULT SUComponentDefinitionGetEntities (SUComponentDefinitionRef comp_def, SUEntitiesRef *entities)
 Retrieves the entities of the component definition. More...
 
SU_RESULT SUComponentDefinitionGetDescription (SUComponentDefinitionRef comp_def, SUStringRef *desc)
 Retrieves the description of the component definition. More...
 
SU_RESULT SUComponentDefinitionSetDescription (SUComponentDefinitionRef comp_def, const char *desc)
 Sets the description of the component definition. More...
 
SU_RESULT SUComponentDefinitionCreateInstance (SUComponentDefinitionRef comp_def, SUComponentInstanceRef *instance)
 Create an instance of a component definition. More...
 
SU_RESULT SUComponentDefinitionGetBehavior (SUComponentDefinitionRef comp_def, struct SUComponentBehavior *behavior)
 Retrieves the behavior of a component definition. More...
 
SU_RESULT SUComponentDefinitionSetBehavior (SUComponentDefinitionRef comp_def, const struct SUComponentBehavior *behavior)
 Sets the component behavior of a component definition. More...
 

Function Documentation

SU_RESULT 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. A definition that has been attached to a parent component or parent model must not be released.

Parameters
[out]comp_defThe component object created.
Returns
SU_RESULT SUComponentDefinitionCreateInstance ( SUComponentDefinitionRef  comp_def,
SUComponentInstanceRef instance 
)

Create an instance of a component definition.

Parameters
[in]comp_defThe component definition object.
[out]instanceThe instance created. return
SU_EXPORT 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.

Parameters
[in]drawing_elemThe given element reference.
Returns
  • The converted SUComponentDefinitionRef if the downcast operation succeeds
  • If not, the returned reference will be invalid
SU_EXPORT 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.

Parameters
[in]entityThe given entity reference.
Returns
  • The converted SUComponentDefinitionRef if the downcast operation succeeds
  • If not, the returned reference will be invalid
SU_RESULT SUComponentDefinitionGetBehavior ( SUComponentDefinitionRef  comp_def,
struct SUComponentBehavior behavior 
)

Retrieves the behavior of a component definition.

Parameters
[in]comp_defThe component definition object.
[out]behaviorThe component behavior retrieved.
Returns
SU_RESULT SUComponentDefinitionGetDescription ( SUComponentDefinitionRef  comp_def,
SUStringRef desc 
)

Retrieves the description of the component definition.

Parameters
[in]comp_defThe component definition object.
[out]descThe description retrieved.
Returns
SU_RESULT SUComponentDefinitionGetEntities ( SUComponentDefinitionRef  comp_def,
SUEntitiesRef entities 
)

Retrieves the entities of the component definition.

Parameters
[in]comp_defThe component definition object.
[out]entitiesThe entities retrieved.
Returns
SU_RESULT SUComponentDefinitionGetName ( SUComponentDefinitionRef  comp_def,
SUStringRef name 
)

Retrieves the name of a component definition.

Parameters
[in]comp_defThe component definition object.
[out]nameThe name retrieved.
Returns
SU_RESULT SUComponentDefinitionRelease ( SUComponentDefinitionRef comp_def)

Releases a component definition object and its associated resources. The object must not be associated with a parent component or model.

Parameters
[in]comp_defThe component definition object.
Returns
SU_RESULT SUComponentDefinitionSetBehavior ( SUComponentDefinitionRef  comp_def,
const struct SUComponentBehavior behavior 
)

Sets the component behavior of a component definition.

Parameters
[in]comp_defThe component definition object.
[in]behaviorThe behavior to set.
Returns
SU_RESULT SUComponentDefinitionSetDescription ( SUComponentDefinitionRef  comp_def,
const char *  desc 
)

Sets the description of the component definition.

Parameters
[in]comp_defThe component definition object.
[in]descThe description to be set. Assumed to be UTF-8 encoded.
Returns
SU_RESULT SUComponentDefinitionSetName ( SUComponentDefinitionRef  comp_def,
const char *  name 
)

Sets the name of a component definition.

Parameters
[in]comp_defThe component definition object.
[in]nameThe name of the component definition. Assumed to be UTF-8 encoded.
Returns
SU_EXPORT SUDrawingElementRef SUComponentDefinitionToDrawingElement ( SUComponentDefinitionRef  comp_def)

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

Parameters
[in]comp_defThe given component definition reference.
Returns
  • The converted SUEntityRef if comp_def is a valid component
  • If not, the returned reference will be invalid
SU_EXPORT SUEntityRef SUComponentDefinitionToEntity ( SUComponentDefinitionRef  comp_def)

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

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