Cleaning Up AutoCAD Drawings
Cleaning Up AutoCAD Drawings
Cleaning Up AutoCAD Drawings
Wish List (/wish-list) Forums (/forum) Get Connected (/get-connected) Articles (/articles)
Walt Sparling
Waltspar@gmail.com
(mailto:Waltspar@gmail.com)
Language
English (https://www.augi.com/?ACT=256&category=171&result_page=articles%2Fsearch)
Country
United States of America (https://www.augi.com/?ACT=256&category=844&result_page=articles%2Fsearch)
Software Products
AutoCAD Platform (https://www.augi.com/?ACT=256&category=39&result_page=articles%2Fsearch)
2014 (https://www.augi.com/?ACT=256&category=982&result_page=articles%2Fsearch)
Back
FEBRUARY 19TH, 2014
https://www.augi.com/articles/detail/cleaning-up-autocad-drawings 1/11
A necessary part of many AutoCAD® users’
5/15/2019 day
Cleaning UpisAutoCAD
cleaning up drawing
Drawings | AUGI -files. NotUser
Autodesk all users
Groupset up their drawings with your use
International
in mind, and sadly some don't set it up with anybody's use in mind. There are a variety of reasons that AutoCAD users would
need to clean up drawings.
MEP users who receive updated backgrounds from architects or civil engineers.
Architects who receive clients’ prototypical drawings that need to be converted to the architects’ standards.
Architects who receive civil drawings to clean up for an architectural site plan.
Autodesk® Revit® users who need to clean up AutoCAD drawings before linking or, in some cases, importing them into
Revit.
Architects and engineers who clean up their drawings before sending them to an outside consultant or owner.
Archivers who need to clean up drawings for archival purposes.
Many times, users will clean up drawings only when they have to, such as for errors (crashing drawings, inability to import in to
other applications), or files being too big to email, etc. By keeping the cleanup process simple and automating as much as
possible, it is more likely to get done on a regular basis. As we all have experienced, issues tend to hit on deadline day.
Everything starts with good habits and procedures. Start by keeping your drawings lean and efficient. Use standard layers,
linetype, and text styles. Use polylines, and polygons when creating objects, use explode as a last resort and use
blocks/dynamic blocks to represent your drawing data. Automate your drawing standards, and object insertion processes
verses copying one job to create another. Sometimes, even with good drawing practices, files will need to be cleaned up.
And when dealing with outside users, cleanup is a lot more likely.
AutoCAD has some built-in tools that can help make the drawing cleanup process much easier. These tools can be used
individually to handle certain cleanup tasks, or they can be used in conjunction with others to handle larger cleanups. A few
of the tools that you may find useful are “Purge,” "Audit," "Selectsimilar," AND Wblock.
A brief outline of what you would use each command for and then a more detailed description of how they can be used for
your cleanup purposes follows, as well as some example scripts on how to automate their use for drawing cleanup. Some of
these commands have dialog and command line options, so depending on your productivity style, you have options. If you
are a mouse dialog, ribbon, or toolbar user, I encourage you to consider the command line versions to increase your
productivity. The command line can be a powerful production option, especially when combined with shortcuts and Macros.
PURGE: Removes unused named objects, such as block definitions and layers, from the drawing using a dialogue or the
command line.
AUDIT: Evaluates the integrity of a drawing and corrects some errors (command line).
SELECTSIMILAR: A simple method to select objects based on similar properties such as layer, color, name, or line weight.
WBLOCK: Saves selected objects out of the current drawing or converts an existing block to a specified external drawing
file.
PURGE
Over time, drawings get bloated with unnecessary and outdated information. This can include unused layers, linetypes, fonts,
styles, and blocks. By getting rid of these extraneous items you keep your drawings lean. Lean drawings use less memory and
have less storage requirements, thus saving drive space, backup space, load and save times, and email overhead. Lean
drawings also are less likely to become corrupt. The following types of unused named objects can be removed from the
current drawing: block definitions, dimension styles, groups, layers, linetypes, and text styles. It will also remove zero-length
geometry and empty text objects. The PURGE command will not remove unnamed objects (see below for unnamed blocks).
Purge can be done from the command line or through a dialog box. For various scenarios you may use one or the other. See
Figure A for the Purge dialog box from AutoCAD 2013. The dialog shows that basically no items are available to be purged. If
you change the top option from “View items you can purge” to “View items you cannot purge,” you can see all the things that
are not “purgeable.” Are these still being used? These can include styles, linetypes, layers, plot styles, and so on. If you don’t
think you are using these, but items will not purge, then check some of the following.
https://www.augi.com/articles/detail/cleaning-up-autocad-drawings 2/11
Blocks:
5/15/2019 Cleaning Up AutoCAD Drawings | AUGI - Autodesk User Group International
Layers:
Styles:
Linetypes:
** One item that will need an extra step is “REGAPPS.” Regapps are a byproduct of objects with extended entity data (xdata).
When you delete an xdata object, a REGAPP ID remains. To remove these, you must do it from the command line.
Anonymous/Un-Named Blocks
Annoying items that creep up quite often are the infamous “un-named”or “anonymous” blocks or groups. These show up as
*A123, *A124, *X12, *D13, etc. You may have noticed that when you ran Audit, there were far more blocks in your drawing than
you thought there should be. This builds over time as you continue to use old projects for new work and when you use
outside vendors or consultants’ drawings. It can be very frustrating to find 1,000 blocks in a drawing that do not show up in
your block list and will not purge! Some of these are created by AutoCAD for hatch patterns [*X nnn], associative dimensions
[*D nnn] and some are created by AutoLISP routines. For me this happens a lot when working with drawings from civil and
architectural offices. To remove the blocks that are not being used, you can use the Wblock or –Wblock command (see
WBLOCK).
AUDIT
From time to time you will get a file that requires recovery to open it, or during a working session you will get an error
suggesting that a recovery may be necessary. One way to keep your drawings healthy is to be proactive and run the audit
command. Audit is a good maintenance tool to run on your drawings to keep them clean of most errors. When you get
drawings from outside firms, this is a must-do step. If a drawing contains errors that AUDIT cannot fix, try using RECOVER to
open the drawing and correct its errors.
Audit is a command line tool. Following are the prompts and options.
Type “Audit”
The following prompt is displayed.
Fix any errors detected? [Yes/ No]. You would typically choose “Yes,” unless you’re just looking to see if the drawing
has errors.
When the routine is done it will give you a status report of how many objects it audited and how many errors it found
and corrected. Running Purge prior to an Audit will often reduce the overhead of auditing items you do not intend to
keep anyway.
Note: If AUDIT or RECOVER do not work and your still getting errors, try inserting the troubled drawing into a clean empty
drawing, EXPLODE it, PURGE, and do a SAVEAS.
SELECTSIMILAR
https://www.augi.com/articles/detail/cleaning-up-autocad-drawings 5/11
How many times have you worked onCleaning
5/15/2019 a drawing where you
Up AutoCAD were| just
Drawings AUGIlooking to User
- Autodesk get just line
Group work or just text isolated on a
International
layer? You try to freeze or isolate text or dims only to find out that half the drawing disappeared. This is a common issue with
various trades where everything associated with a specific topic is on a single layer. For example, an architectural drawing has
a ceiling plan layer: "A-CLG" that includes the grid, the lights, the diffusers, the notes, and the dimensions all on one layer—in
different colors (ugh!). Or how about an HVAC drawing that has the main ducts, flex ducts, and supply grille/diffuser blocks all
on a single "M-SUPPLY" layer. Sometimes you just need the lights or grid or supply grille locations, but doing layer isolate
(another handy tool) gives you everything. Selectsimilar to the rescue!
Selectsimilar provides you with a way to select objects based on similar characteristics. Objects based on properties such as
layer, color, or lineweight can be grabbed quickly with this command. Access the command by typing “selectsimilar” at the
command line or from the right-click shortcut menu after you've selected an object. What is selected will depend on the
current SELECTSIMILARMODE value.
If you have objects with a different color being included when selecting objects based on color, note that objects are
considered similar if they are set to “BYLAYER.” This also includes properties like linetype, lineweight, plot style, material, and
transparency. For example, you may get text or line work selected even though they are not the same color if their color
property is set to BYLAYER.
To select similar objects, you can type “SELECTSIMILAR” (create a shortcut like “SS”) or select an object that represents the
category of objects you want to select, right-click, and choose “SELECT SIMILAR.”
Note Only objects of the same type (lines, circles, polylines, etc.) are considered similar. You can change other shared
properties with the SELECTSIMILAR command, using the “SE” (Settings) option.
The Settings dialog box controls which properties must match for an object of the same type to be selected.
[AW-2013-12-AutoCAD-Image-0004.png]
SELECTSIMILARMODE
https://www.augi.com/articles/detail/cleaning-up-autocad-drawings 6/11
To automate the SELECTSIMILAR command
5/15/2019 Cleaningin
UpaAutoCAD
macro or script |you
Drawings would
AUGI use User
- Autodesk SELECTSIMILARMODE.
Group International As with many
AutoCAD commands, each combination of options has a bit code (numerical value). Some examples:
To determine these values, run the SELECTSIMILAR command, type SE, and toggle the options. Then run the
SELECTSIMILARMODE command to find the numeric value of these options.
I use "130" most often. This allows me to isolate named objects like "Text" on the same layer. Using Selectsimilar to select a
piece of text on a layer would select all text on that layer - no matter what style or color it is. Selecting a polyline with the 130
setting would select all polylines on that layer - no matter what color. Selecting a block would only select other blocks with
the same name on that layer. Each of these is useful when selecting items that you may wish to delete or move to another
layer.
WBLOCK
The WBLOCK (Write Block) command is probably best known for saving selected objects or a block within a drawing to an
external drawing file. WBLOCK can be a very powerful cleanup tool in your arsenal. Probably the most common method of
drawing extraction is to type WBLOCK and follow select the options in the dialog to save parts of a drawing to a specific drive
and folder.
The dialog gives you three options: You can choose a block within the drawing, the entire drawing, or objects that you want to
selectively ‘write out’ of the drawing. When selecting objects, you select a base point, select the desired objects, and then
select a new name and path where your file is to be saved.
You also have the option to access the quickselect dialog to select items via a properties filter.
You can also use WBLOCK from the command line. To use WBLOCK at the command line, add a hyphen in front of the
command, e.g., -WBLOCK.
It will then prompt you to enter a name of an existing block or define a new drawing. You have three options here.
Type an existing block name within the drawing that you want to “write out.” (Use if you have created a block in the
current drawing and you want it now saved out to your master library or a project folder.)
Hit enter and a new drawing will be created with the name you entered in the previous dialog. You will be able to select
an insertion point and select the objects to write-out. (Use if you want to selectively write out objects to a new drawing
file.)
Type an asterisk ‘*’ which will cause it to write out the entire drawing. (Use to do a mass cleanup of your drawings in a
single sweep.)
When cleaning up client drawings or your own from rogue data that has been inserted (often through copy-paste operations),
this is a very powerful tool. This handy method writes the entire drawing to the new output file, except for unreferenced
symbols. Model space objects are written to model space, and paper space objects are written to paper space.
https://www.augi.com/articles/detail/cleaning-up-autocad-drawings 7/11
If you use the dialog to do your WBLOCK
5/15/2019 operations,
Cleaning even
Up AutoCAD when you
Drawings selectively
| AUGI - Autodeskchoose your
User Group objects, takes all the junk with it
International
that you already can’t purge.
Try this:
Open a drawing that has unpurgeable items (bunch of *A1nnn blocks) Say “A1.DWG”.
Turn On, Unlock, and Thaw all your layers.
Type WBLOCK and choose the “Objects” option.
Select everything in your drawing (crossing, window, etc.).
For the Destination, choose a new file name “A1-Objects.DWG.”
Type AUDIT and see how many objects are in the drawing.
Compare your size to the original A1.DWG.
Wblock Results:
Before:
(Already Purged), Audit reports 114,900 objects and 3,478 blocks - 4,327 KB.
After:
WBLOCK (Entire drawing option OR –Wblock with “*”), Audit reports 4,600 objects 71 blocks - 291 KB (93 percent smaller).
The second option removes all those unused and unpurgeable items that the first would not. See how much faster your
drawings open, save, and close.
++ Be careful, though, as both of these methods will remove any Layer States in the drawings.
Example macros:
https://www.augi.com/articles/detail/cleaning-up-autocad-drawings 8/11
SuperSave:
5/15/2019 Cleaning Up AutoCAD Drawings | AUGI - Autodesk User Group International
^C^C-PURGE;A;*;N;AUDIT;Y; -PURGE;A;*;N;-PURGE;R;*;N;AUDIT;Y;-PURGE;A;*;N;-WBLOCK;
^C^CSELECTSIMILARMODE; 130;SELECTSIMILAR;/ERASE;P;
Note: be sure to define your “similar” mode in your script/macro by setting the “selectsimilarmode” value.
If you have to commonly bind and save your drawings to an older version (SAVEAS), you can have a Macro setup just for that.
^C^CZ;E;-PURGE;A;;N;AUDIT;Y;-PURGE;A;;N;-PURGE;R;*;N;-PURGE;A;;N;BINDTYPE;1;-XREF;B;*;SAVEAS;2004;
There is not one “super cleanup” command or macro tool that will work for everyone, but you can get pretty close to what will
equate to “your” super tool with a little thought. Look at your cleanup process—what are you repeating or what is client “A”
always requiring as part of the cleanup process? Automate these items using the tools above and tweak as necessary for each
client.
Let’s say you want one ultimate macro that varies slightly by client, but is pretty consistent overall. Some things you may
want:
The below macro would accomplish that and would take literally seconds to run.
If every job is totally unique for you and you need a generic macro, you would remove the layer states option above and you
may want to skip the SETBYLAYER command as it may give undesired results when plotting.
After the macro runs, you could use some of the other tools mentioned above to clean up the drawing even further.
Standardization, automation, and training are the best tools for increasing your efficiency in any process in AutoCAD. Once
you find out which tools (commands/macros/scripts/LISPs) are your go-to items and you have a set process, you can whip
through the drawing cleanup process. Over time I have standardized on many of the above commands and macros, but I am
https://www.augi.com/articles/detail/cleaning-up-autocad-drawings 9/11
always looking for new options to reduce
5/15/2019 any Up
Cleaning repetitive
AutoCADor time-wasting
Drawings tasks. User Group International
| AUGI - Autodesk
TEST
Test, Test, Test! When incorporating new tools and methods into your arsenal or cleanup process, be sure to test on non-
production drawings or at least copies of drawings before you implement these as standard tools. Each office may have
unique file requirements that need to be considered when implementing these processes.
OTHER TOOLS
This article by no means covers all the tools available for drawing cleanup, but these are some very useful ones that when
used individually or in conjunction with others can make your drawing cleanup process go much faster. As there are a
multitude of options and tools available in AutoCAD for cleaning up your drawings, I encourage you to look in to some of
these other powerful commands and AutoCAD options:
SETBYLAYER:
Sets selected objects to color BYLAYER (as they should be). You can also use this to change the linetype, lineweight, material,
and transparency to BYLAYER. Like SELECTSIMILAR, SETBYLAYER has a mode value (SETBYLAYERMODE) that can be set (i.e.,
for color only the value is 113). I typically do NOT change linetype to BYLAYER as it is a common scenario to have a linetype set
to by entity but on the same layer with other line types.
FILTER:
To create saved selection sets.
OVERKILL
Use to remove duplicate items in a drawing that share the same space (i.e., doors, walls, lights, etc.) right on top of one
another. This often happens when binding similar XREFs or copying items and inadvertently selecting the same origin and
destination point and not realizing it.
Marilyn Law
marilyn.law@comcast.net
(mailto:marilyn.law@comcast.net)
Language
English
(/articles/category/English)
Country
United States of
America
https://www.augi.com/articles/detail/cleaning-up-autocad-drawings (/articles/category/usa) 10/11
5/15/2019 Software
Cleaning Up AutoCAD Products
Drawings | AUGI - Autodesk User Group International
AutoCAD Platform
(/articles/category/autocad-
platform)
2014
(/articles/category/autocad-
2014)
Back
(http://www.link
(http://www.youtube.com
(http://feeds.feedbur
gid=86322)
(http://www
(http:/
Sponsors (/sponsors) | Benefactors (/benefactors) | Advertising (/advertising) | Terms of Service (/terms-of-service) | Privacy Policy (/privacy-policy) | Sitemap (/sitemap)
| Contact (/contact)
©1990-2019 Autodesk User Group International, Inc. All Rights Reserved.
https://www.augi.com/articles/detail/cleaning-up-autocad-drawings 11/11