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.

22 Responses to “How to optimize your AutoCAD DWG drawing files

  • Hello
    Hope you are doing great.
    I offenly face this problem .I f i copy components from different autocad files to my present working file.It end up having many annotation in the present file layout view .
    I have done the drawings & annotations but if i copy something other file
    my layout drawing end up having other annotations.
    If you could help?

  • Heather
    7 years ago

    There is a command… that “merges” lines that are on top of each other….
    But dang if I can remember the command! Can you help?
    I’m working with a drawing that was a 3D – 5story building… flattened to 2D… with many many many overlapped lines. I have no clue what program the arch. exported it from but it is almost impossible to work with because of the file size. Yes I w-blocked out so at least I’m down to just the visible info… but still soooooo many lines. Argh ;)

    Thanks.
    Heather

  • archie
    7 years ago

    Also purging Orphaned data and using DGN Purge helps reduce the massive drawing file size, see link below

    https://www.facebook.com/autocadsharing/photos/a.572171626182169.1073741827.137901589609177/594055580660440/?type=3&theater

  • minte
    8 years ago

    is there any way that i could copy AutoCAD assignment document from my friends with out being caught as cheater by my instructor ?

    • I can’t believe that you would even ask that here :(

    • Frank Hull
      7 years ago

      No, but there are LOADS of ways your instructor can determine that it WAS copied.

  • Nilesh
    8 years ago

    Hi Paul,

    This is Nilesh and i’m very much newer for AutoCAD. I need your one help about the AutoCAD working area. See, my problem is when i draw or practice something in AutoCAD 2016 it will be a very very much smaller size. Actually i’m not getting why this happen. I mostly work in millimeters unit scale and when I start draw that size is not match in 1:1 scale on scree and also on print also.

    You know when i start to create a line from 0,0 and end upto 0,10 it works put it is only in one small grid scale which is a negligible to view or print on paper.

    Can you help me to resolve this please a exact drawing scale 1:1 it is in mm either in inch. why not exact dimensions are come.

    Thanks!!! hope u reply soon with positive solution waiting for your answer.

    Nilesh

  • Charles Malchev
    8 years ago

    None of the above helped. Would someone personally review my dwg, please ?

  • Raul Wallaart
    9 years ago

    Hi!
    thank you for the clear post on this important matter! Specially in environments where a lot of people work on a lot of drawings.

    We encountered an issue concerning LAYERSTATES that were used in third party drawings. We, ourselves don’t use layer states but all the x-ref’d drawing took them along and slowed down the host drawing very much, specially because this became a big list of layer states.

    Deleting them from the received drawings (although I never like to touch any of third parties drawings, but in this case inevitable) helped us a lot!

    Since we were not used to use this command, this was another hidden mystery to solve. It might help others too!

    Kind regards
    Raul

  • Paul Munford you are a truely life saver.Helped me a lot to optimize.Mike V also shared such an amazing tips in the comments.

    Guys Keep sharing tweaks .Thanks

  • Nicely presented blog, Paul. A few things here to learn from and apply.

  • Mike V
    12 years ago

    If you use Autodesk Architecture, there is one more way to clean up drawings even more.  Open the Styles Manager, (Format Tab on the Ribbon), right click the drawing and select PURGE, click OK (or select what you want to purge).  Then hit APPLY.  This will clean out any unsued/old AEC styles that might be hiding in the drawing adding to the size of the drawing.  Once ACA is done purging, click OK and then do a regular purge.  I’ve taken drawings from 8-10 MB down to 1 or 2 MB by doing this before exporting our drawings to outside design firms.  It makes them open and save a lot quicker too.

    • That’s a great tip Mike!

      Thanks for taking the time to comment :)

    • Claudius
      8 years ago

      is there a way to do this through the command line?

      • Hi Claudius,

        All of these commands can be run from the command line. You could write a Macro or Script to run the commands in sequence, use the command recorder or Write a Lisp routine to automate this for you.

        Is there a specific section you need help with?

        Paul