Implementing the Stretch Point Functions

The set of stretch points for an entity is often a subset of its grip points. When the user invokes the STRETCH command, the getStretchPoints() function is used to return the stretch points defined for the selected entity. For many entities, grip mode and stretch mode are identical. The implementation for the AcDbEntity::getStretchPoints() function and the AcDbEntity::moveStretchPointsAt() function is to invoke your subGetGripPoints() and subMoveGripPointsAt() functions.

The signatures for the stretch functions are

virtual Acad::ErrorStatus
AcDbEntity::subGetStretchPoints(
    AcGePoint3dArray& stretchPoints) const;
 
virtual Acad::ErrorStatus
AcDbEntity::subMoveStretchPointsAt(
    const AcDbIntArray&  indices,
    const AcGeVector3d&  offset);

You are not required to override the subGetStretchPoints() and subMoveStretchPointsAt() functions of AcDbEntity; they default to the getGripPoints() and transformBy() functions.

The custom AsdkPoly class overrides these functions as shown in the example in this section. The subGetStretchPoints() function returns the vertices of the polygon, but not the center. The subMoveStretchPointsAt() function checks whether all the stretch points have been selected. If they have, it invokes the transformBy() function. Otherwise, it invokes the moveGripPointsAt() function.

 // Stretch points are the same as grip points except 
 // for the center of the polygon. 
 // 
 Acad::ErrorStatus 
 AsdkPoly::subGetStretchPoints( 
     AcGePoint3dArray& stretchPoints) const 
 { 
     assertReadEnabled(); 
     Acad::ErrorStatus es; 
  
     if ((es = getVertices3d(stretchPoints)) 
         != Acad::eOk) 
     { 
         return es; 
     } 
  
     // Remove the duplicate point at the start and end. 
     // 
     stretchPoints.removeAt(stretchPoints.length() - 1); 
     return es; 
 } 
  
 Acad::ErrorStatus 
 AsdkPoly::subMoveStretchPointsAt( 
     const AcDbIntArray& indices, 
     const AcGeVector3d& offset) 
 { 
     return moveGripPointsAt(indices, offset); 
 }