04-Feb-2025
When developing AutoLISP routines in ProgeCAD, you may encounter situations where a command starts executing before the previous command has completely finished. This usually happens when the previous command is waiting for user input, such as selecting an object or entering text.
To ensure your LISP routine executes commands in the correct order, you can use one of the following methods.
If a command requires user interaction, insert the pause function within the command statement. This temporarily stops the LISP routine and waits for the user to complete the required input before continuing.
You can use multiple pause functions if several user inputs are expected. However, this approach is only suitable when you know approximately how many inputs the user must provide.
A more reliable solution is to use the CMDACTIVE system variable. This continuously checks whether the previous command is still active and waits until it has completed.
(while (= 1 (getvar "cmdactive"))
(command pause)
)
This loop prevents the next command from executing until the currently running command has completely finished.
Without waiting for command completion, multiple commands may run simultaneously, causing unexpected behavior, incomplete operations, or errors in your AutoLISP program. Using the CMDACTIVE method ensures your automation routines execute sequentially and reliably.
Murari Software Solutions provides expert support for ProgeCAD customization, including AutoLISP development, CAD automation, menu customization, licensing assistance, and technical support. Contact our team if you need help developing or troubleshooting ProgeCAD LISP applications.