Overriding saveAs()

You should override saveAs() if you want to save an alternate graphical representation for saving proxy entity graphics. If your custom entity doesn't override the AcDbEntity::saveAs() function, AutoCAD leverages your subWorldDraw() function to support proxy entity graphics. The AcDbEntity::saveAs() function merely calls the worldDraw() function.

virtual void
AcDbEntity::saveAs(
    AcGiWorldDraw *pWd,
    AcDb::SaveType saveType);

The saveType parameter is always kR13Save.

From within saveAs(), you may call the worldDraw() function or make direct AcGiWorldGeometry and AcGiSubEntityTraits calls, or you may do nothing at all in order to prevent saving proxy graphics for your entity.

Before calling saveAs(), AutoCAD first replaces the AcGiWorldDraw geometry and traits objects is replaced with special subclasses of AcGiWorldGeometry and AcGiSubEntityTraits. These subclasses's geometric primitive and property traits functions cache the data in the appropriate format rather than performing a display. After calling saveAs(), the cached data is written to disk.

saveAs() does not allow preserving any view-dependent graphics. The viewportDraw() function is not called even if you implement saveAs() to call worldDraw() and that returns false. Your custom entity may rely on its subViewportDraw() function for its graphics, so its subWorldDraw() function alone would not produce an appropriate image. In that case, you need to implement saveAs() to produce reasonable graphics for proxy objects.

For more information about proxy graphics data, see Proxy Objects.