Overview of File Organization (Concept)

AutoCAD

 
Overview of File Organization
Concept Quick Reference
 
 
 

AutoCAD uses support files for purposes such as storing customization definitions, loading AutoLISP and ObjectARX applications, and describing text fonts.

The default directory structure for the AutoCAD program and support files is designed to efficiently organize those files into logical groups. If this organization does not suit your needs, you can change it. However, some applications look for certain files in specific locations, and you should verify that your modifications do not conflict with the requirements of those applications. Without the full path, including drive and directory, AutoCAD can locate only those files that are found in the library search path.

The location of the support folder changed in AutoCAD 2004. The location of local customizable files is stored in the LOCALROOTPREFIX system variable. The location of roamable customizable files is stored in the ROAMABLEROOTPREFIX system variable. If a network supports roaming, customizable files in the user's roaming profile are available on the machine the user is logged onto.

The following LISP script creates the CUSTFILES command, which launches Windows® Explorer in the correct folder.

(defun c:custfiles ()
  (command "shell" 
    (strcat "explorer \"" (getvar "roamablerootprefix") "\"")
  )
  (princ)
)

Library Search Path

The library search path specifies where the program searches for files when you do not specify a full path name, as follows:

  • Current directory. (This is typically determined by the “Start In” setting in your shortcut icon.)
  • Directory that contains the current drawing file.
  • Directories listed in the search path specified on the Files tab in OPTIONS. (See Specify Search Paths and File Locations in the User's Guide.)
  • Directory that contains the AutoCAD program files.

Depending on the current environment, two or more directories may be the same.

If a file is not in this search path, you must specify both its path name and file name before AutoCAD can find it. For example, if you want to insert the part5.dwg drawing into your current drawing and it is not in the library search path, you must specify its full path name, as shown here:

Command: insert

Enter block name or [?]: /files2/olddwgs/part5

If the drawing exists in that location, AutoCAD prompts you to finish the INSERT command in the usual manner.

Directory Structure

AutoCAD uses tree-structured directories and subdirectories. It is recommended that you keep supplemental files (such as AutoLISP applications and customization files) separate from the AutoCAD program and support files. This makes it easier to track possible conflicts and to upgrade each application without affecting the others.

The default location for AutoCAD is in the Program Files folder. You can create a new directory on the same level (for example, /AcadApps) and store your custom AutoLISP and VBA macros, customization files, and other third-party applications in subdirectories on the next level. If you want to maintain multiple drawing directories (for separate job files), you can create a directory such as /AcadJobs with subdirectories for each job.

Command Search Procedure

When you enter a command, AutoCAD goes through a series of steps to evaluate the validity of the command name. A command can be a built-in command or system variable, an external command or alias defined in the acad.pgp file, or a user-defined AutoLISP command. Commands can also be defined by ObjectARX applications or a device driver command. You can enter a command on the command prompt or choose a command from the appropriate menu. Commands can also be entered from a script file or by an AutoLISP or ObjectARX application.

The following list describes the search order AutoCAD uses to validate a command name.

  1. If the input is a null response (SPACEBAR or ENTER), AutoCAD uses the name of the last command issued. HELP is the default.
  2. AutoCAD checks the command name against the list of built-in commands. If the command is in the list and is not preceded by a period (.), AutoCAD then checks the command against a list of undefined commands. If the command is undefined, the search continues. Otherwise, the command is run, unless another reason prevents it from doing so. Running it transparently or in Perspective mode might be impossible.
  3. AutoCAD checks the command name against the names of commands defined by a device driver, and then by those defined by the display driver.
  4. AutoCAD checks the command name against the external commands defined in the program parameters file (acad.pgp). If the command name corresponds to a defined external command, that command runs, and the search is complete.
  5. AutoCAD checks the command name against the list of commands defined by AutoLISP or ObjectARX applications. At this point, an autoloaded command is loaded.
  6. AutoCAD checks the command name against the list of system variables. If the command name is in the list, AutoCAD executes the SETVAR command, using the input as the variable name.
  7. If the command name corresponds to a command alias defined in the program parameters file, AutoCAD uses the expanded command name and continues the search, starting a new search against the list of built-in commands.
  8. If all the preceding steps fail, the search terminates with a warning message about illegal command names.