An important feature of attributes is the ability of an attribute to control its behavior when its owning entity is split, merged, or translated during a modeling operation. Each attribute class provides methods (member functions) in its implementation file (.cxx) that control its behavior during splitting, merging, or translation.
|
|
When an owner entity is split, another entity is created and the application deletes, duplicates, or modifies the attribute. The default action is to do nothing. In Figure 3-2 if the small block is inserted into the larger block and subtracted, face
A is separated into face
A and face
A'. For both faces to keep the attribute, it must be copied and attached to the face
A'. The
split_owner method controls this operation and accepts a pointer to the new entity (in this example, face
A').
|
|
virtual void split_owner(ENTITY*);
|
|
|
|
Figure 3-2. Split Entity
|
|
When two entities are merged , the attributes may need to be handled differently. In the example in Figure 3-3, if the body owning face
B is merged with another body that owns face
B', one face is deleted. The attributes assigned either to face
B or to face
B' may be assigned to the resulting face, or the attributes may be combined. For example, if both faces had a centroid attribute, the combination of the attributes for a merge would require a recalculation. The
merge_owner method has two arguments: the entity pointer (to face
B' in this example), and a logical flag that indicates whether the entity containing the attribute is the one being deleted (FALSE in this example).
|
|
virtual void merge_owner(ENTITY*, logical);
|
|
Note
|
In a merge, merge_owner is called once for each attribute on B, and once for each attribute on B'.
|
|
|
|
Figure 3-3. Merging Entities
|
|
The
trans_owner method alerts attributes when the owner entity is transformed. Method
trans_owner is called in all modeling operations that apply transformations to entities, such as
api_apply_transf and
api_change_body_trans, as well as Boolean operations. The
trans_owner method has one argument: the transform.
|
|
virtual void trans_owner(SPAtransf const&);
|
|
Attribute classes also implement other common methods for such things as copying or replacing the owning entity. Many of these methods are defined using macros defined in the
at_macro.hxx file. In addition, methods that are common to entities--and therefore, to attributes--are defined via macros defined in
entity_macro.hxx. Other common methods are inherited from
ATTRIB.
|