Site icon The CAD Setter Out

How to optimize your AutoCAD DWG drawing files

If you’ve been following the CAD Setter Out for a while, you will know that I recommend keeping your geometry organised as you go along.

The Autodesk DWG icon

Using Polylines, Groups, Blocks, Layers and Xref’s effectively will help you to work quickly with your drawings files. Working this way will also go some way to preventing your AutoCAD DWG files becoming bloated or corrupt.

If you’ve been working on a file for some time, and you’ve noticed AutoCAD slowing down, then it may be worth doing a bit of a cleanup to help slim that drawing file down. This could also be necessary when dealing with files from clients, suppliers or contractors.

I’ve listed a few tools and tips below that could help you put a bit of zip back into a sluggish DWG.

(If you use Architectural Desktop, check out the extra tip from Mike in the comments)

Back up before you mess up!

As always, save a copy of your production DWG files before you mess about with them :) This is particularly important if you  are working with a third party drawing.

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 exploded 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 really, really careful that you don’t explode a dynamic block. The dynamic properties of the block will not be able to resolve themselves and this may corrupt your DWG.

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.

Note: A quick way to delete all unnecessary objects from your drawing file is to hit CTRL+A (select all), then hold down the Shift key whilst de-selecting what you want to keep. now hit delete. Poof!  All unused data will be gone ;)

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.

Note: From 2010 AutoCAD has the option to purge empty text strings in the ‘PURGE’ dialogue – see below.

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.

Note: AutoCAD 2012 now has the option to purge empty groups – see below.

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.

Tip: Use ‘LAYMRG’ to merge objects to a target layer. The original layers are purged from the drawing.

Tip: Use the ‘LAYDEL’ command to permanently delete any layers that you can’t shake. Be careful with this tool – there’s no going back!

Note: The system variable ‘SHOWLAYERUSAGE’ puts a check mark in the layer dialogue by each layer that is in use. If you have lots of layers in your drawings, setting this to ‘0’ will prevent AutoCAD from tracking ‘in use’ layers, which will help speed things up.

 

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.

The AutoCAD Delete Filters command

Note: The command is ‘FILTERS‘ – not ‘FILTER’. The Filter command is like an Uber Quick select tool.

Check your styles

AutoCAD 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. Check which styles are current before you purge.

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, it’s definition will still be in the drawing’s database. This is the same for Annotation styles.

Remember to check the ‘Purge nested objects’ box to clear out nested block references. AutoCAD 2010 has the handy option to clear out empty text and zero length lines. AutoCAD 2012 includes the option to purge empty groups.

Application menu > Drawing Utilities Panel > Purge

Command entry: purge

AutoCAD Drawing utilities

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. I recommend that you purge your file production files frequently as part of your housekeeping routine.

AutoCAD's Purge command dialogue

Tip: You can use the PURGE command as a detective tool to help with problem files. Checking the ‘View items you cannot purge’ radio button to discover any un-PURGE’able nasty’s that are hidden in your drawings.

How often do you 'PURGE' your drawings?

View Results

Loading ... Loading ...

If you need to clean up a lot of problem drawings, you could try either of these third party plugins:

http://www.jtbworld.com/smartpurger.htm

http://www.manusoft.com/software/superpurge.html

Purge Regapps

‘PURGE REGAPPS’, is a secret option of the 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 such as AutoCAD Architectural desktop to use if they need it. If you receive files that could have been created with one of the AutoCAD verticals, you can claw back some memory space by using this command.

Type ‘-purge’ at the command line, then type ‘r’ and hit ‘enter’ to chose ‘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.

Note: If you created a backup copy of your file, compare the file size now. You should notice that it is substantially reduced.

AutoCAD Purge Regapps

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.

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 (The Big Red A) and choose, Drawing utilities > Recover. You will be prompted to pick a file.

Note: This is one of the few things in you can do in AutoCAD without a drawing open already.

The file will be Audited, and then opened in AutoCAD.

Wblock

If nothing else works, try ‘WBLOCK’ing the 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.

Other issues that could be slowing your DWG down

If you are running antivirus software, make sure that common AutoCAD file types such as DWG, DWS, DWT, DXF, BAK, SV$ are excluded. You can see a full list of AutoCAD file extensions here:

HyperPics: File Extensions Related to AutoCAD

 

The Scale List Bug

AutoCAD 2008 included a bug which copied all annotation scales from x-referenced drawings into the host drawings, even if they already existed. This creates a massive number of unrequired scales in your drawing. If you are working with someone who is using AutoCAD 2008, you might still come across this problem.

More modern releases of AutoCAD have an automatic detection system for this problem. If you open a problem file, AutoCAD will prompt you to see if you want to re-set the scale list. I recommend you choose ‘Yes’!

To reset the scale list in a corrupted drawing, follow the command line entries below:

Command: -SCALELISTEDIT Enter option [?/Add/Delete/Reset/Exit] <Add>: Reset
Reset scale list to defaults? [Yes/No] <No>: Yes
Scale list reset to default entries.
Enter option [?/Add/Delete/Reset/Exit] <Add>: Exit

If you are using xref’s, make sure you clean out the xreff’d files before you clean out the host drawing.

If you need to clean up lots of files you can use this Scale List Clean up utility from Autodesk.

Download the Scale List Clean up Utility from Autodesk

Full and Partial saves

AutoCAD only does a ‘full’ save when you hit save. AutoSaves are incremental (only what’s changed will be saved). The system variable ‘ISAVEPERCENT’ controls how often a full save will be done. Setting isavepercent to 0, will result in a longer save time, but a better organised fie (all saves will be full). Setting isavepercent to 100 will result in a faster save time, but more sluggish performance.

I hope that you found this article useful and that you’ve managed to breath some new life into your crusty old DWG’s!

Read this post for more ways to clean up your AutoCAD geometry for output to CNC/CAM.