Handles in Extended Data

AutoCAD AutoLISP & Visual LISP

 
Handles in Extended Data
 
 
 

Extended data can contain handles (group 1005) to save relational structures within a drawing. One entity can reference another by saving the other's handle in its xdata. The handle can be retrieved later from xdata and then passed to handent to obtain the other entity. Because more than one entity can reference another, xdata handles are not necessarily unique. The AUDIT command does require that handles in extended data either be NULL or valid entity handles (within the current drawing). The best way to ensure that xdata entity handles are valid is to obtain a referenced entity's handle directly from its definition data by means of entget. The handle value is in group 5.

When you reference entities in other drawings (for example, entities that are attached with XREF), you can avoid protests from AUDIT by using extended entity strings (group 1000) rather than handles (group 1005). The handles of cross-referenced entities are either not valid in the current drawing, or they conflict with valid handles. However, if an XREF Attach changes to an XREF Bind or is combined with the current drawing in some other way, it is up to the application to revise the entity references accordingly.

When drawings are combined by means of INSERT, INSERT*, XREF Bind (XBIND), or partial DXFIN, handles are translated so they become valid in the current drawing. (If the incoming drawing did not employ handles, new ones are assigned.) Extended entity handles that refer to incoming entities are also translated when these commands are invoked.

When an entity is placed in a block definition (with the BLOCK command), the entity within the block is assigned new handles. (If the original entity is restored by means of OOPS, it retains its original handles.) The value of any xdata handles remains unchanged. When a block is exploded (with the EXPLODE command), xdata handles are translated in a manner similar to the way they are translated when drawings are combined. If the xdata handle refers to an entity that is not within the block, it is unchanged. However, if the xdata handle refers to an entity that is within the block, the data handle is assigned the value of the new (exploded) entity's handle.