Exercise 2: Create the Script File

The next step is to create an AutoCAD script. An AutoCAD script is a text file that issues the commands you would type at the Command prompt in AutoCAD Map 3D toolset to execute an operation. It has some special syntax to make sure that the commands are properly executed outside the application.

Note:

This exercise continues the process of batch-exporting from the previous exercise, Creating the Export Profile.

Each line in the script file is a response to a Command prompt within the export operation.

The finished script file looks like the following example (except for your replacements for file and folder names):

_-mapexport
FDO_SDF
SDFs\Temp.sdf
_yes
D:\Demo\MyExport.epf
_proceed
_quit

Create the script file in a text editor, such as Notepad.

To create the script file

  1. Start the Notepad application from your computer desktop. For example, click Start Accessories Notepad.
  2. Enter the following:

    _-mapexport

    This line initiates the export operation. The underscore indicates that the command or prompt will be in English (and will not be translated). Therefore, the script runs in any language.

  3. Press Enter and enter the following:

    FDO_SDF

    This line is the Command prompt response to "Enter file type to export to, or ? for list <FDO_SDF>:" It specifies that you will export the DWG file to SDF format.

  4. Press Enter and enter the following:

    SDFs\Temp.sdf

    Replace SDFs\ with the name of the folder where you will store the temporary SDF files required by the operation.

    This line is the Command prompt response to "Enter name of file to create <D:\PreviousExport.sdf>:"

  5. Press Enter and enter the following:

    _yes

    This line is the Command prompt response to "Load Profile? [Yes/No] <No>:" In this case you want to load a profile.

  6. Press Enter and enter the full pathname of the folder and file containing your export profile. For example, enter:

    D:\Demo\MyExport.epf

    Specify the same folder as the DWG files to export.

    This line is the Command prompt response to "Enter path and name of .EPF file for options:"

  7. Press Enter and enter the following:

    _proceed

    This line is the Command prompt response to "Change options [Selection/Data/Options/ Proceed] <Proceed>:"

  8. Press Enter and enter the following:

    _quit

    This line ends the script and returns control to the batch file.

  9. Save and close the script file.

    Save the script file in the same folder as the DWG files to export.

To continue this tutorial, go to Creating the Batch File.