Keeping drawings clean and working
Last updated: 2016-03-10
Purge
AutoCAD's PURGE command will allow you to clear out data from your AutoCAD file's database that isn't part of the drawing. For example, even if you have deleted all copies of a block out of a drawing, its definition will still be in the drawing's database. This is the same for components of any type.
Remember to check the ‘Purge nested objects' box to clear out nested block references. AutoCAD has the handy option to clear out empty text and zero length lines and includes the option to purge empty groups.
Application menu > Drawing Utilities Panel > Purge
Command entry: purge
Save your file after you've purged it to re-write the database before you audit. You may need to purge and audit a couple of times to completely clean up your DWG. Best practice is to purge your production files frequently as part of your housekeeping routine.
Purge regapps
This is a command line only version of the purge command. ‘Regapps' is short for ‘Registered Applications.
AutoCAD holds a bit of memory space free for vertical products to use if they need it. If you receive files that could have been created with one of the AutoCAD verticals, or other third party add-ons, you can get back some memory space by using this command.
Type -purge at the command line, then type r and hit enter to choose Regapps. AutoCAD will prompt you to list the names you want to purge. Just hit enter to accept the default asterisk * which will select all the available regapps. Now type N and hit enter so you don't have to verify each regapp to be purged.
AutoCAD will recreate any regapps memory space it needs should the file be re-opened by an AutoCAD vertical, so this won't cause anyone problems down the line.
Audit
AutoCAD's AUDIT command inspects the drawing file's database for errors. Type AUDIT at the command line, Type Y to fix errors and then hit the F2 key to see what AutoCAD has done to your file. Save your file before you run the purge command again.
You may need to run the Purge – save and Audit – save commands a few times to completely optimize your file.
Go easy on explodes
If you receive a drawing from a third party, don't be tempted to explode all their blocks. This can be a really bad idea. If there is more than one copy of each block in the drawing then the blocks will actually be saving memory.
If you suspect a block is causing a problem, copy it out into a blank file and explode it. Then follow the advice below on the new file. Carefully rebuild the block and then replace or re-define the block in the original drawing.
Be careful that you don't explode a dynamic block. The dynamic properties of the block may not be able to resolve themselves and this may corrupt your DWG. If you need to explode a simple dynamic block, make sure that the Dwg Clean tool or purge and audit are completed on the drawing prior to continuing and saving the drawing.
Delete unused geometry
If you need to make a change to your drawing, it can be tempting to copy the old detail to one side ‘just in case'. This is all additional data that AutoCAD needs to manage. If you end up with a lot of unnecessary, old or out-dated geometry, create an archive copy of the AutoCAD DWG file and delete your intermediate work from your working DWG file.
When working with Civil 3D objects, be sure to name alternatives uniquely, even if they represent the same thing. Also, keep track of data shortcuts and data references to be sure you are using the intended alternatives in downstream drawings.
When deleting Civil 3D objects, pay attention to dependencies. Start by deleting children and then move on to the parent objects. For example, an alignment needs to be deleted, but there are several profiles and offset alignments associated with that alignment. Start by deleting the profiles and offset alignments. Then delete the parent alignment. Another example is deleting a corridor with corridor surfaces. Start by deleting the corridor surface from the corridor surface dialogue within the corridor properties. Then, delete the corridor object. If the option is available, delete a Civil 3D object from the dialogue it was created whenever possible.
Find Invisible objects
There are a number of objects that could be effecting your DWG's file size – that aren't always visible. This could include empty text strings, points and blocks that contain only invisible attributes.
To pick up points, type DDPTYPE at the command line to change the size and style of points in your drawing. You can now delete what you don't need.
To find empty text strings, type QTEXTMODE at the command, set the value to 1 and perform a regen. This will replace all the text strings in your drawing with bounding boxes. You can now hunt down and delete any empty text boxes. Set qtextmode back to 0 when you are done to put your text back to normal.
To find Block definitions that contain Invisible attributes, type ATTDISP at the command line, and set attribute display to on. You can now select and delete any previously invisible blocks that you don't need.
To find 3D objects with invisible faces, type SPLFRAME at the command line, and set the value to 1. This will reveal the shapes control polygon, allowing you to select and delete it.
It is possible to create an AutoCAD group with nothing in it. Fire up the GROUP command and ‘explode' any groups you don't need or recognise.
Finally, to find wipeouts that have their frames turned off type ‘TFRAMES' at the command line and hit return. This system variable toggles wipeout frames on and off.
Delete unused layers
Did you know that AutoCAD won't let you delete a layer that is in use? Open the Layer manager, select every Layer you don't need and hit Delete. You can't accidently delete a layer you need. This will get rid of a whole load of extra data that AutoCAD doesn't need to manage.
AutoCAD won't let you delete the active layer, so check which layer is active before you start. AutoCAD won't let you delete a layer that is frozen in a viewport – even if there are no objects on that layer, so check through each viewport if you have problem layers.
Use LAYMRG to merge objects to a target layer. The original layers are purged from the drawing.
Use the LAYDEL command to permanently delete any layers that you can't shake. Be careful with this tool – there's no going back!
Delete unused Layer filters
Now you've deleted all the layers you don't need out of your drawing, maybe you've got a whole load of layer filters you don't need either? The quickest way to clean out layer filters is with the FILTERS command. This pops up a little dialog which allows you to quickly delete unused layer filters from your AutoCAD DWG file.
Check your styles
Civil 3D won't let you purge text, dimension or multi-leader styles while they are in use – even if you are not using the style in the drawing they may be being consumed in civil object styles or assigned to current styles. Check which styles are current before you purge.
Recover
The recover command is a little like the AUDIT command – only you run it before you open the problem drawing. To use the recover command, go to the application menu and choose, Drawing utilities > Recover. You will be prompted to pick a file. The file will be Audited, and then opened in AutoCAD.
Wblock
Wblock should only be used with native AutoCAD objects and never used with civil objects such as alignments, profiles, profile views, corridors, cross sections, and assemblies to name a few.
You can also try ‘WBLOCK'ing the native AutoCAD geometry you require into another drawing. The wblock command will only take what it needs to support what you have chosen to export from your drawing. This can leave corrupted elements behind. Native AutoCAD objects are things like lines, polylines, blocks, dimensions, ant text. Basically anything that is included in the Home ribbon, Draw and Modify panels can be used to Wblock.