Home > Getting Started Guide > Application Interface > Attributes
Attribute Notification Methods
An important feature of an attribute is the ability to control its behavior when its owning entity is modified during a modeling operation. Attributes are notified of their owner being modified using an attribute notification method.
Notification methods are most typically called from within ACIS geometric algorithms that are in the process of tearing down and rebuilding the model. As a result, take care in your implementation of each notification method not to assume too much about the validity of the model. You may safely assume that the attribute’s owner exists and that any input entity into the notification method exists, but you may not assume anything about the state of the model above or below the owner or the input entity(s).
Furthermore, a complex attribute that has pointers to topological and/or geometric entities in the model may not assume that those entities still exist. The ATTRIB class provides following notification methods:
- copy_owner
- split_owner
- merge_owner
- trans_owner
- to_tolerant_owner
- from_tolerant_owner
- replace_owner
- lop_change_owner
- replace_owner_geometry
- reverse_owner
- warp_owner
virtual void copy_owner( ENTITY *copy_ent ); The copy_owner method notifies "this" attribute that its owner has been copied. The copy of its owner is given as input, copy_ent.
Applications can specify how they want their attribute to behave in this method by either:
- Setting the copy_owner action in their attribute’s constructor.
- Implementing this method directly.
Use the ATTRIB::set_copy_owner_action method to set a copy_owner action. The types of copy_owner actions available are:
CopyLose
- Lose the attribute if its owner is copied.
CopyKeep
- Do nothing if the owner is copied. Default.
CopyCopy
- Create a new instance of the attribute on the new owner (using ATTRIB::duplicate()).
In the event a complex attribute has its copy_owner action set to CopyCopy, ACIS creates a new instance of that complex attribute on the "copy_ent"; the caveat, however, is that all entity pointers (other than the owner_ptr) will be set to NULL.
If the copy_owner actions are not sufficient to meet your attribute’s specific needs, then the copy_owner method may be implemented directly.
A commonly asked question is "What is the difference between copy_owner and COPY_DEF?" api_copy_entity and api_copy_body copy all "copyable" attributes using the standard COPY_DEF mechanism. api_down_copy_entity, in contrast, notifies each attribute using its copy_owner method. Why the distinction? Note that api_copy_entity is a full-body copy. An attribute’s COPY_DEF implementation may trust that the full body is being copied. api_down_copy_entity, on the other hand, is a partial-body copy. As such, complex attributes cannot make any assumptions about the state of the entities to which they point. Therefore, api_down_copy_entity uses copy_owner.
virtual void split_owner( ENTITY *new_entity ); The split_owner method notifies "this" attribute that its owner has been split. The new portion of the split is given as input, "new_entity".
Applications can specify how they want their attribute to behave in this method by either:
- Setting the split_owner action in their attribute’s constructor.
- Implementing this method directly.
Use the ATTRIB::set_split_owner_action method to set a split_owner action. The types of split_owner actions available are:
SplitLose
- Lose the attribute if its owner is split.
SplitKeep
- Do nothing if the owner is split. Default.
SplitCopy
- Create a new instance of the attribute on the new entity (using ATTRIB::duplicate()).
In the event a complex attribute has its split_owner action set to SplitCopy, ACIS creates a new instance of that complex attribute on the "new_entity"; the caveat, however, is that all entity pointers (other than the owner_ptr) will be set to NULL.
If the split_owner actions are not sufficient to meet your attribute’s specific needs, then the split_owner method may be implemented directly.
Figure. Split Entity
virtual void merge_owner( ENTITY * entity, logical del_owner ); The merge_owner method notifies "this" attribute that its owner has been merged. The process of merging implies that one of the two entities involved in the merge is lost during the merge process. Of these two entities, the go-ent is defined as the entity that is going away, and the keep-ent, as the entity that is being kept.
Note: merge_owner is called twice for a merge: once for all attributes on the go-ent, and once for all attributes on the keep-ent:
- Once with del_owner set to TRUE, which means "this" attribute’s owner is the go-ent, and the input "entity" is the keep-ent.
- Once with del_owner set to FALSE, which means "this" attribute’s owner is the keep-ent, and the input "entity" is the go-ent.
Applications can specify how they want their attribute to behave in this method by either:
- Setting the merge_owner action in their attribute’s constructor.
- Implementing this method directly.
Use the ATTRIB::set_merge_owner_action method to set a merge_owner action. The types of merge_owner actions available are:
MergeLose
- Lose the attribute if its owner is merged.
MergeKeepKept
- Do nothing if the owner is merged. Default.
MergeKeepLost
- Transfer attribute from entity being lost to entity being kept.
MergeKeepAll
- Move attribute from entity being lost to entity being kept.
If the merge_owner actions are not sufficient to meet your attribute’s specific needs, then the merge_owner method may be implemented directly.
Figure. Merging Entities
virtual void trans_owner( const SPAtransf &transf ); The trans_owner method notifies "this" attribute that its owner has been transformed. The transform is given as input.
Applications can specify how they want their attribute to behave in this method by either:
- Setting the trans_owner action in their attribute’s constructor.
- Implementing this method directly.
Use the ATTRIB::set_trans_owner_action method to set a trans_owner action. The types of trans_owner actions available are:
TransLose
- Lose the attribute if its owner is transformed.
TransIgnore
- Do nothing if the owner is transformed. Default.
If the trans_owner actions are not sufficient to meet your attribute’s specific needs, then the trans_owner method may be implemented directly.
virtual void to_tolerant_owner( ENTITY *tol_ent );
virtual void from_tolerant_owner( ENTITY *non_tol_ent );The to_ and from_tolerant_owner methods notify "this" attribute that its owner is being lost and is being replaced by a new, tolerant owner (to_tolerant_owner); or new, non-tolerant (from_tolerant_owner). The new owner is given as input.
Applications can specify how they want their attribute to behave in these methods by either:
- Setting the to_tolerant_owner/from_tolerant_owner actions in their attribute’s constructor.
- Implementing these methods directly.
Use the ATTRIB::set_to_tolerant_owner_action/ATTRIB::set_from_tolerant_owner_action method to set a tolerant_owner action. The types of tolerant_owner actions available are:
TolerantLose
- Lose the attribute if its owner is made tolerant/non-tolerant.
TolerantMove
- Move the attribute to the new owner (only possible if "this" attribute returns moveable() == TRUE). Default.
If the tolerant_owner actions are not sufficient to meet your attribute’s specific needs, then the to_tolerant_owner/from_tolerant_owner methods may be implemented directly.
virtual void replace_owner( ENTITY *other_entity, logical replace_owner ); The replace_owner method notifies "this" attribute that its owner is being replaced by a new owner. The process of replacing implies that one of the two entities involved will be lost during the replacement process. Of these two entities, we define the go-ent as the entity that is going away, and the keep-ent as the entity that is being kept.
Note: replace_owner will be called twice for a replacement: once for all attributes on the go-ent, and once for all attributes on the keep-ent:
- Once with replace_owner set to TRUE, which means "this" attribute’s owner is the go-ent, and the input "entity" is the keep-ent.
- Once with replace_owner set to FALSE, which means "this" attribute’s owner is the keep-ent, and the input "entity" is the go-ent.
Applications can specify how they want their attribute to behave in this method by either:
- Setting the replace_owner action in their attribute’s constructor.
- Implementing this method directly.
Use the ATTRIB::set_replace_owner_action method to set a replace_owner action. The types of replace_owner actions available are:
ReplaceLose
- Lose the attribute if its owner is replaced.
ReplaceKeepKept
- Keep the attribute on the entity being kept. Default.
ReplaceKeepLost
- Move the attribute from the entity going away to the entity being kept, lose any on kept.
ReplaceKeepAll
- Move the attribute from the entity going away to the entity being kept, keep any on kept.
If the replace_owner actions are not sufficient to meet your attribute’s specific needs, then the replace_owner method may be implemented directly.
virtual void lop_change_owner(); The lop_change_owner method notifies "this" attribute that its owner has somehow been geometrically (or possibly topologically) changed by a local-operation. The specific nature of the change is not known to the attribute.
Applications can specify how they want their attribute to behave in this method by either:
- Setting the lop_change_owner action in their attribute’s constructor.
- Implementing this method directly.
Use the ATTRIB::set_lop_change_owner_action method to set a lop_change_owner action. The types of lop_change_owner actions available are:
GeomChangedLose
- Lose the attribute if its owner is geometrically changed.
GeomChangedKeep
- Do nothing if the owner is geometrically changed. Default.
If the lop_change_owner actions are not sufficient to meet your attribute’s specific needs, then the lop_change_owner method may be implemented directly.
virtual void replace_owner_geometry(ENTITY *new_geom); The replace_owner_geometry method notifies "this" attribute that its owner is to receive new geometry. The new geometry is given as input.
Applications can specify how they want their attribute to behave in this method by either:
- Setting the replace_owner_geometry action in their attribute’s constructor.
- Implementing this method directly.
Use the ATTRIB::set_rep_owner_geom_action method to set a replace_owner_geometry action. The types of replace_owner_geometry actions available are:
GeomChangedLose
- Lose the attribute if its owner is geometrically changed.
GeomChangedKeep
- Do nothing if the owner is geometrically changed. Default.
If the replace_owner_geometry actions are not sufficient to meet your attribute’s specific needs, then the replace_owner_geometry method may be implemented directly.
virtual void reverse_owner(); The reverse_owner method notifies "this" attribute that its owner’s sense bit is about to be reversed.
Applications can specify how they want their attribute to behave in this method by either:
- Setting the reverse_owner action in their attribute’s constructor.
- Implementing this method directly.
Use the ATTRIB::set_reverse_owner_action method to set a reverse_owner action. The types of reverse_owner actions available are:
GeomChangedLose
- Lose the attribute if its owner is geometrically changed.
GeomChangedKeep
- Do nothing if the owner is geometrically changed. Default.
If the reverse_owner actions are not sufficient to meet your attribute’s specific needs, then the reverse_owner method may be implemented directly.
virtual void warp_owner( law *warp ); The warp_owner method notifies "this" attribute that its owner will be modified by warping. The warp being applied is given as input.
Applications can specify how they want their attribute to behave in this method by either:
- Setting the warp_owner action in their attribute’s constructor.
- Implementing this method directly.
Use the ATTRIB::set_warp_owner_action method to set a warp_owner action. The types of warp_owner actions available are:
GeomChangedLose
- Lose the attribute if its owner is geometrically changed.
GeomChangedKeep
- Do nothing if the owner is geometrically changed. Default.
If the warp_owner actions are not sufficient to meet your attribute’s specific needs, then the warp_owner method may be implemented directly.
[Top]
© 1989-2007 Spatial Corp., a Dassault Systèmes company. All rights reserved.