SUAPI-CppWrapper
C++WrapperforSketchUpCAPI
Public Member Functions
CW::ComponentDefinition Class Reference

#include <ComponentDefinition.hpp>

+ Inheritance diagram for CW::ComponentDefinition:

Public Member Functions

 ComponentDefinition ()
 
 ComponentDefinition (SUComponentDefinitionRef definition, bool attached=true)
 
 ComponentDefinition (const ComponentDefinition &other)
 
 ~ComponentDefinition ()
 
ComponentDefinitionoperator= (const ComponentDefinition &other)
 
SUComponentDefinitionRef ref () const
 
 operator SUComponentDefinitionRef () const
 
 operator SUComponentDefinitionRef * ()
 
ComponentInstance create_instance () const
 
Entities entities () const
 
String name () const
 
bool name (String name)
 
bool is_group () const
 
Behavior behavior () const
 
void behavior (const Behavior &behavior) const
 
size_t num_used_instances () const
 
size_t num_instances () const
 
std::vector< ComponentInstanceinstances () const
 
size_t num_openings () const
 
std::vector< Openingopenings () const
 
- Public Member Functions inherited from CW::DrawingElement
 DrawingElement (SUDrawingElementRef drawing_element, bool attached=true)
 
 DrawingElement (const DrawingElement &other, SUDrawingElementRef element_ref=SU_INVALID)
 
 DrawingElement ()
 
DrawingElementoperator= (const DrawingElement &other)
 
SUDrawingElementRef ref () const
 
 operator SUDrawingElementRef () const
 
 operator SUDrawingElementRef * ()
 
BoundingBox3D bounds ()
 
bool copy_properties_from (const DrawingElement &element)
 
bool casts_shadows () const
 
bool casts_shadows (bool casts_shadows)
 
bool hidden () const
 
bool hidden (bool hidden)
 
Layer layer () const
 
bool layer (Layer &layer)
 
Material material () const
 
bool material (const Material &material)
 
bool receive_shadows () const
 
bool receive_shadows (bool receive_shadows)
 
- Public Member Functions inherited from CW::Entity
 Entity ()
 Constructor representing a null objject.
 
 Entity (SUEntityRef entity, bool attached=true)
 Creates a new Entity object. More...
 
 Entity (const Entity &other, SUEntityRef entity_ref=SU_INVALID)
 Copy constructor with an optional parameter for the entity reference. More...
 
 ~Entity ()
 Destructor. More...
 
Entityoperator= (const Entity &other)
 Copy assignment operator.
 
 operator SUEntityRef () const
 
 operator SUEntityRef * ()
 
SUEntityRef ref () const
 
bool attached () const
 Returns true if the entity is attached to another object.
 
void attached (bool attach)
 Method lets the object know that it has been attached to a model. This is important as it will let the object know that it does not need to "release" the object. More...
 
std::vector< AttributeDictionaryattribute_dictionaries () const
 Returns the AttributeDictionaries collection attached to the entity. More...
 
AttributeDictionary attribute_dictionary (const std::string &name) const
 Returns an attribute dictionary object with a given name that is attached to an Entity. More...
 
bool add_dictionary (AttributeDictionary &dict)
 Adds the AttributeDictionary to the Entity. More...
 
bool copy_attributes_from (const Entity &entity)
 Copies attributes from another Entity object to this one. More...
 
bool is_valid () const
 Checks if the entity is valid. More...
 
bool operator! () const
 Returns true if this entity is not valid. Alias of !is_valid().
 
int32_t entityID () const
 Retrieve a unique ID assigned to an entity. More...
 
TypedValue get_attribute (const std::string &dict_name, const std::string &key, const TypedValue &default_value=TypedValue()) const
 Retrieves the value of an attribute in the entity's attribute dictionary. More...
 
TypedValue get_attribute (const AttributeDictionary &dict, const std::string &key, const TypedValue &default_value=TypedValue()) const
 Retrieves the value of an attribute in the entity's attribute dictionary. More...
 
bool set_attribute (const std::string &dict_name, const std::string &key, const TypedValue &value)
 Sets the value of an attribute in the given AttributeDictionary object. More...
 
bool set_attribute (AttributeDictionary &dict, const std::string &key, const TypedValue &value)
 Sets the value of an attribute in the given AttributeDictionary object. More...
 
enum SURefType entity_type () const
 Returns the type of the entity. See enum SURefType.
 
Model model () const
 
Entities parent () const
 
int64_t persistent_id () const
 

Additional Inherited Members

- Protected Attributes inherited from CW::Entity
SUEntityRef m_entity
 The C SUEntityRef that this class wraps.
 
bool m_attached
 Indicates whether the Entity has been attached to a model.
 

Detailed Description

This class represents a component definition.

Definition at line 51 of file ComponentDefinition.hpp.

Constructor & Destructor Documentation

CW::ComponentDefinition::ComponentDefinition ( )

Constructor creates empty Component Definition, ready to add to a model.

Definition at line 73 of file ComponentDefinition.cpp.

CW::ComponentDefinition::ComponentDefinition ( SUComponentDefinitionRef  definition,
bool  attached = true 
)

Constructor creates Component Definition from existing SUComponentDefinitionRef.

Definition at line 79 of file ComponentDefinition.cpp.

CW::ComponentDefinition::ComponentDefinition ( const ComponentDefinition other)

Copy constructor.

Definition at line 87 of file ComponentDefinition.cpp.

CW::ComponentDefinition::~ComponentDefinition ( )

Destructor will release the definition object if it had not been added to a model.

Definition at line 92 of file ComponentDefinition.cpp.

Member Function Documentation

Behavior CW::ComponentDefinition::behavior ( ) const

Returns the Behavior object of this component.

Definition at line 202 of file ComponentDefinition.cpp.

ComponentInstance CW::ComponentDefinition::create_instance ( ) const

Creates a new ComponentInstance from this ComponentDefinition.

Definition at line 128 of file ComponentDefinition.cpp.

Entities CW::ComponentDefinition::entities ( ) const

Creates a new Group from this ComponentDefinition. If the definition is not a Group definition, the method will fail. TODO: requires testing

This method is not possible to implement with the current API (2017) Gets the entities in the definition.

Definition at line 150 of file ComponentDefinition.cpp.

std::vector< ComponentInstance > CW::ComponentDefinition::instances ( ) const

Returns the instances of this ComponentDefinition.

Definition at line 238 of file ComponentDefinition.cpp.

bool CW::ComponentDefinition::is_group ( ) const

Returns whether this definition is of a group.

Definition at line 186 of file ComponentDefinition.cpp.

String CW::ComponentDefinition::name ( ) const

Gets the name of the component.

Definition at line 161 of file ComponentDefinition.cpp.

bool CW::ComponentDefinition::name ( String  name)

Sets the name of the component.

Definition at line 174 of file ComponentDefinition.cpp.

size_t CW::ComponentDefinition::num_instances ( ) const

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.

Definition at line 230 of file ComponentDefinition.cpp.

size_t CW::ComponentDefinition::num_openings ( ) const

Retrieves the number of openings from the component definition.

Since
SketchUp 2016, API 4.0

Definition at line 258 of file ComponentDefinition.cpp.

size_t CW::ComponentDefinition::num_used_instances ( ) const

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.

Definition at line 222 of file ComponentDefinition.cpp.

std::vector< Opening > CW::ComponentDefinition::openings ( ) const

Retrieves the openings from the component definition.

Since
SketchUp 2016, API 4.0

Definition at line 269 of file ComponentDefinition.cpp.

ComponentDefinition & CW::ComponentDefinition::operator= ( const ComponentDefinition other)

Copy assignment operator

Copy assignment operator.

Definition at line 103 of file ComponentDefinition.cpp.

SUComponentDefinitionRef CW::ComponentDefinition::ref ( ) const

Cast to native objects Returns the SUComponentDefinitionRef that this class wraps.

Definition at line 118 of file ComponentDefinition.cpp.


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