Component:Generic Attributes

From DocR21

Jump to: navigation, search


C++ APIs | Scheme Extensions
edit  

Generic Attributes Component


The Generic Attributes Component (GA) provides a means for applications to capture and exchange application-specific data. The GA classes allow items such as names, numbers, strings, vectors, and positions to be attached to an entity or a list of entities as an attribute. GA created attributes can be saved and restored.

Generic attributes allow applications to exchange data that is not supported by ACIS without having to share code to define new ENTITY and/or ATTRIB classes. Each generic attribute associates a name with a simple data value. Attributes are defined which have integer, real, string, position, vector, and entity values. There is also an attribute with only a name and no associated value. Hierarchies of values can be created by attaching attributes to other attributes to represent more complex data structures.

edit  

Generic Attributes Classes



Class Description
ATTRIB_GEN_NAME Stores a name.
ATTRIB_GEN_INTEGER Stores a named integral value.
ATTRIB_GEN_REAL Stores a named floating-point double value.
ATTRIB_GEN_POINTER Stores a named pointer to an ENTITY. ("Weak" relationship.)
ATTRIB_GEN_ENTITY Stores a named pointer to an ENTITY. ("Strong" relationship.)
ATTRIB_GEN_POSITION Stores a named 3-space position (three doubles).
ATTRIB_GEN_VECTOR Stores a named 3-space vector (three doubles).
ATTRIB_GEN_STRING Stores a named single-byte character string (char).
ATTRIB_GEN_WSTRING Stores a named wide character string (wchar_t).


edit  

Generic Attributes Interface


APIs

Generic Attributes can be constructed and attached to an ENTITY using ACIS_NEW. Alternately, ACIS provides several overload flavors of api_add_generic_named_attribute, for example, api_add_generic_named_attribute.

To remove a Generic Attribute from an ENTITY, we suggest using api_remove_generic_named_attribute.

Direct Interface Functions

The Direct Interface provides two functions for finding generic attributes attached to ENTITYs.

Operation Description
find_named_attrib Returns a pointer to the first generic attribute with the given name in an ENTITY's list of attributes.
find_next_named_attrib Returns a pointer to the next generic attribute with the same name and owner as the supplied attribute.

Scheme Extensions

Scheme AIDE provides several Scheme extensions to create and maintain Generic Attributes. These are enumerated in the table below.

Scheme Extension Description
attrib:add Adds a generic attribute to an entity or a list of entities.
attrib:get Gets the generic attributes attached to a given entity.
attrib:remove Deletes a generic attribute from an entity or list of entities.
attrib:replace Replaces all generic attributes of a given name from an entity or list of entities.
generic:add Adds a generic attribute to an entity or list of entities.
generic:get Gets the value of a named generic attribute attached to an entity.
generic:remove Removes each generic attribute with the given name from each entity in the list.


edit  

Generic Attributes Behaviors


When creating a Generic Attribute, you can specify how the attribute should behave when its owner is split, merged, transformed, or copied. For example, if your Generic Attribute is attached to a FACE and the FACE is split during a modeling operation, you can specify that your Generic Attribute copy itself to the new FACE created by the split. Plus, if you use one of our predefined behaviors, it is saved along with your Generic Attribute. This ensures that your Generic Attribute will behave as you desire, even outside your application.

For customized behavior within your application, Generic Attributes can also be instructed to call an application specified function when split, merged, transformed, or copied.

The following enums are used for specifying how your attribute should behave when split, merged, transformed, and copied: split_action, merge_action, trans_action, and copy_action.

If the predefined Generic Attribute behaviors and/or capabilities do not meet your application's needs, consider creating your own custom attribute. Refer to these articles for more information: Attributes and Attribute Tutorial.


edit  

Generic Attributes See Also

Personal tools
Live