Setting the Default File Format

ObjectARX ® provides the ability to specify the default file format for the SAVEAS, SAVE, and QSAVE commands. (The AUTOSAVE command always saves drawings in the native format of the AutoCAD version being used.)

The class AcApDocument contains an enumeration that defines the format used when saving a drawing to a file. See SaveFormat enum in the ObjectARX Reference for a list of possible values.

The formatForSave() function returns the current save format being used by the SAVEAS, SAVE, and QSAVE commands:

The value returned may be either the session‑wide default setting, or a different setting that the user has selected for this document. If it is an override for this document, it will not persist across sessions.

The setDefaultFormatForSave() function uses one of the SaveFormat values to set the file format to use when saving a drawing with the SAVEAS, SAVE, and QSAVE commands. This sets the session‑wide default, which the user may choose to temporarily override for an individual document.

These functions only directly report on or set the file format for interactive commands entered by the user. If you want your application to use the current save format, every time you wish to save the database, you will first need to call formatForSave(), and then use the returned SaveFormat value to determine which function to call. For example, if formatForSave() returned k2000_dxf, you would call acdbDxfOutAs2000() to write the database as an AutoCAD 2000 DXF file.

Be sure to take the following into account: