Entity Data Functions and Graphics Screen

Changes to the drawing made by the entity data functions are reflected on the graphics screen, provided that the entity being deleted, undeleted, modified, or made is in an area and is on a layer that is currently visible. There is one exception: when acdbEntMod() modifies a subentity, it does not update the image of the entire (complex) entity. The reason should be clear. If, for example, an application were to modify 100 vertices of a complex polyline with 100 iterated calls to acdbEntMod(), the time required to recalculate and redisplay the entire polyline as each vertex was changed would be unacceptably slow. Instead, an application can perform a series of subentity modifications and then redisplay the entire entity with a single call to the acdbEntUpd() function.

In the following example, the first entity in the current drawing is a polyline with several vertices. The following code modifies the second vertex of the polyline and then regenerates its screen image.

ads_name e1, e2; 
struct resbuf *ed, *cb; 
if (acdbEntNext(NULL, e1) != RTNORM) { 
    acutPrintf("\nNo entities found.  Empty drawing."); 
    return BAD; 
}
acdbEntNext(e1, e2); 
if ((ed = acdbEntGet(e2)) != NULL) { 
    for (cb = ed; cb != NULL; cb = cb->rbnext) 
        if (cb->restype == 10) { // Start point DXF code
            cb->resval.rpoint[X] = 1.0;// Change coordinates.
            cb->resval.rpoint[Y] = 2.0; 
            if (acdbEntMod(ed) != RTNORM) { // Move vertex.
                acutPrintf("\nBad vertex modification."); 
                acutRelRb(ed); 
                return BAD; 
            } else { 
                acdbEntUpd(e1); // Regen the polyline.
                acutRelRb(ed); 
                return GOOD; // Indicate success.
            } 
        } 
    acutRelRb(ed); 
} 
return BAD; // Indicate failure.

The argument to acdbEntUpd() can specify either a main entity or a subentity; in either case, acdbEntUpd() regenerates the entire entity. Although its primary use is for complex entities, acdbEntUpd() can regenerate any entity in the current drawing.

Note: If the modified entity is in a block definition, then the acdbEntUpd() function is not sufficient. You must regenerate the drawing by invoking the AutoCAD REGEN command (with acedCmdS() or acedCommandS()) to ensure that all instances of the block references are updated.