Automatically Purge Scale List
February 15, 2008 by rockmaster
Tired of seeing all of those xref’d scales showing up in your scale list? Never use ‘em? Here’s a little AutoLisp routine you can use to automatically purge the list upon opening a drawing.
Create a text file in C:\Program Files\AutoCAD 2008\Support (or elsewhere in your support path) called scalelistreset.lsp. Paste the following into the file:
(setvar "cmdecho" 0)(terpri)(command "-scalelistedit")(command "reset")(command "yes")(command "exit")
You can download this file here (right-click and select Save Link As…): scalelistreset.lsp
In order to get this routine to run every time you open a file, open up acaddoc.lsp and add the following line:
(load "scalelistreset")
Create acaddoc.lsp if it doesn’t already exist. Again, the file needs to reside in your support path.
That’s it. Enjoy your pristine scale lists.
Update: Between the Lines has posted an announcement about Autodesk’s new, free Scale List Cleanup Utility.
Thanks rockmaster:
This is a wonderful feature, thanks again for helping me eliminating those annoying xref’d scales. keep up the good work, Great job!
mg.
Is there a way to edit/modify the scalelist that is used when it is reset? Using 2008.
melaku: thanks!
lpseifert: good question. Yes and no. According to Steve Johnson, “In AutoCAD 2008, the default scale list is embedded in the program code and cannot be modified.” However, there should be a way around this. We could add some code to our LISP routine to delete the scales that we don’t want, using -SCALELISTEDIT. I’ll try to provide this at some point in the future.
I’m looking for a way to automate the scalelistedit purge when I save my drawing. If Dwg A is xref’d into Dwg B and I work on Dwg A, I don’t want scales I’ve created during my work session to now appear in Dwg B. And the xref-scales won’t purge in Dwg B as they have to be purged out the parent drawing first.
Any suggestions on how this can be done automatically at the Save command?
You could create a command which purges your drawing’s scalelist then saves the drawing. Put this in a file (call it saveslp.lsp) in your AutoCAD Support directory:
(defun c:saveslp ()(setvar "cmdecho" 0)(terpri)(command "-scalelistedit")(command "reset")(command "yes")(command
"exit")(command "qsave")(command "")
)
In order to get this routine to run every time you open a file, open up acaddoc.lsp and add the following line:
(load "saveslp")Now you need to run the SAVESLP command everytime you want to save the drawing. You can type it manually, or you can assign an alias to it, or you can use CUI to edit your button bar or menu so the standard save commands are replaced by saveslp.
A few caveats: if you close a drawing and you have unsaved changes, then you click “yes” to save those changes, this command will not be run. You could create a similar LISP routine that purges the scalelist and runs the close command, but that still won’t work with the close button (the red “x”
or with CTRL-F4 or with the shutdown of AutoCAD. Also, the command will save brand new drawings into your default save directory (Documents and Settings\USER\My Documents\Drawing1.dwg). And it won’t work with the SaveAs command - that would require another LISP routine.