What it does
Purge/Audit Helper with the CLEANHELP AutoLISP command
Wraps the host CAD application's AUDIT and command-line PURGE workflows behind a clear confirmation prompt and grouped undo request for drawing cleanup.
- AutoLISP command
- CLEANHELP
- Difficulty
- Intermediate
Applicable disciplines
CAD workflows that use this routine
Requirements and compatibility
What it needs
Software rows marked “Not tested” are not compatibility claims. Test the routine in a copy of your drawing and CAD version.
Downloadable source code
Review the purge-audit-helper.lsp AutoLISP code
;; CADLisp Tools - Purge/Audit Helper
(defun c:CLEANHELP (/ *error* answer undo-started)
(defun *error* (message)
(if undo-started (command-s "_.UNDO" "_End"))
(if (and message (not (wcmatch (strcase message) "*CANCEL*,*QUIT*,*EXIT*")))
(prompt (strcat "\nCLEANHELP stopped: " message)))
(princ))
(initget "Yes No")
(setq answer (getkword "\nRun AUDIT and all-item PURGE? [Yes/No] <No>: "))
(if (= answer "Yes")
(progn
(if (= 0 (logand 8 (getvar "UNDOCTL")))
(progn (command-s "_.UNDO" "_Begin") (setq undo-started T)))
(command-s "_.AUDIT" "_Yes")
(command-s "_.-PURGE" "_All" "*" "_No")
(if undo-started (progn (command-s "_.UNDO" "_End") (setq undo-started nil)))
(prompt "\nAudit and purge commands completed. Review command history."))
(prompt "\nCleanup cancelled."))
(princ))
Setup
How to install the purge-audit-helper.lsp file
- 1Download and review the source code.
- 2Load the .lsp file with APPLOAD in a copy of a drawing.
- 3Keep the routine session-only until it has been tested for your CAD version and standards.
Command workflow
How to run the CLEANHELP command
- 1Save a copy of the drawing.
- 2Run CLEANHELP.
- 3Type Yes to run AUDIT and one all-item PURGE pass.
Worked example
Example: Clean a copied drawing before transmittal.
- Save a backup.
- Run CLEANHELP.
- Confirm and review command history.
The host commands audit and purge eligible unused definitions once.
Read before use
Notes and limitations
- Built-in command prompts can differ across CAD products and versions.
- Purged definitions or audit repairs may not be fully recoverable in every host even when an undo group is requested; keep a backup.
- Not manually CAD-tested.
Version history