DCL Error Handling

AutoCAD AutoLISP & Visual LISP

 
DCL Error Handling
 
 
 

The PDB feature checks a DCL file for errors the first time you load it. If AutoCAD encounters a syntax error, a misuse of attributes, or any other error (such as failure to specify a key attribute for an active tile), the PDB does not load the DCL file. Instead, AutoCAD either displays one or more dialog boxes alerting you to the error, or writes a list of errors to a text file called acad.dce. If AutoCAD writes the error messages to acad.dce, it alerts you to this with a message similar to the following:

You can inspect the contents of acad.dce to find the problem. AutoCAD places the acad.dce file in the current working directory. When AutoCAD reads a DCL file successfully, it deletes the acad.dce file.

If your application uses multiple DCL files, the acad.dce file is overwritten (or deleted if no errors occur) when each new file is loaded. When you test the program, acad.dce shows errors (if any) from only the DCL file most recently read. It is recommended that you use the VLISP DCL Preview feature to debug your DCL files (see Displaying Dialog Boxes with Visual LISP). You can also load and debug each file manually in AutoCAD with the load_dialog function. The following load_dialog function loads the DCL file hellofile.dcl:

Command:  (load_dialog "hellofile")

3

If the dialog box loads successfully, load_dialog returns a positive integer that identifies the DCL file. You pass this value to the new_dialog function to initialize individual dialog boxes in the file.

The new_dialog function returns T if it succeeds; otherwise it returns nil. If new_dialog returns T, call the start_dialog function to display the dialog box.

Once you've debugged each DCL file, you can load your program and test the dialog boxes in combination. If your program calls a restricted function between the start_dialog and done_dialog calls, AutoCAD terminates all dialog boxes and displays the following error message:

AutoCAD rejected function

SeeFunctions Restricted When a Dialog Box Is Open for information on which functions are restricted.