Back

Drawing Purge: Quick, Efficient Clean Up

Ever since the LISP programming language (i.e. “LISt Processing”)—aka “Lost In Silly Parentheses” for you old school users—was introduced in AutoCAD® version 2.18 way back in 1986 , creating add-on routines for AutoCAD has been both an adventure and a challenge to make AutoCAD work a little more efficiently, and make AutoCAD users’ lives a lot better.

I remember waiting eagerly for the latest CAD magazines to come in each month just to check out what new routines were introduced.  Depending on the length of code, I could spend hours retyping the code into an ASCII editor so that I would have a copy for myself (and hoping you typed every character correctly the first time), thereby being the envy of many of my fellow CAD users in our local user group. This was LONG before there was an Internet where you can simply search and download a new routine, which brings us to the point of this review.

Now, nearly 30 years later, the new challenge has become finding that special routine within the vast number and types of routines readily available for download.

In this article, I will review the routine “Drawing Purge,” created by Ajilal Vijayan (with additional code created by Kean Walmsley), which is available through the Autodesk Exchange website.

On the surface, the function of a routine called “Drawing Purge” may sound rather obvious and this routine could easily get passed over, but as we dig deeper into what it is capable of, I promise you will be quick to add it.

What it Does

On top of the routine effectively purging unused AutoCAD data such as blocks, layers, linetypes, etc. from an AutoCAD drawing, this routine does an excellent job of purging both regular and complex DGN linetypes. AutoCAD has had the ability to import DGN files since 2008, but it has always been a challenge to completely purge any unused DGN data (even after Autodesk supplied a Hot Fix to combat the problem).   I have personally noticed that having unused/unpurgeable DGN can cause a drawing’s file size to increase as well as slow down the drawing.  

Once I ran this routine on one of my AutoCAD® Civil 3D® drawing files, literally thousands of DGN related-data was purged from my drawing. How so many got there in the first place is astonishing considering none of them were “visible.” Not only did my Civil 3D drawing work faster, it also decreased in file size!

Compatible Drawing Versions That Can Be Purged

This routine works on the following 32/64 bit AutoCAD versions and vertical applications:

AutoCAD Versions: 2016, 2015, 2014, 2013, 2012

AutoCAD Architecture Versions: 2016, 2015, 2014, 2013

AutoCAD Civil 3D Versions: 2016, 2015, 2014, 2013

AutoCAD Electrical Versions: 2016, 2015, 2014, 2013

AutoCAD Mechanical Versions: 2016, 2015, 2014, 2013

AutoCAD MEP Versions: 2016, 2015, 2014, 2013

The Commands

Drawing Purge has two main commands: DWG-PURGE and DWG-PURGE-BATCH.

The first command, DWG-PURGE, will purge the current drawing of its unused AutoCAD items as well as DGN-related linetypes as previously mentioned. The command works very fast, and once complete, the command line history will show you what was purged.

Figure 1: Command line history with purge results

As you can see in Figure 1, DWG-PURGE can purge the usual AutoCAD items, DGN-related items, as well as Registry Applications and Annotation Scales, which typically takes four separate commands/utilities to do. Having an all-in-one routine is very appealing and efficient.

The only caveat to using the main DWG-PURGE command is that if this routine is set up to purge Xrefs, you could potentially purge a coworker’s drawing file attached to your current drawing, and they may not want their drawings purged without their knowledge or permission.  However, there is a simple solution explained below.

The other command, DWG-PURGE-BATCH, allows you to assign which items are to be purged including the option to purge any Xrefs attached to the current drawing.  The routine’s ability to purge attached Xrefs without having to open them first is a very powerful feature, and it does this extremely fast. As stated above, be cautious when using the option to purge Xrefs in case a coworker owns the file. 

Another impressive feature is being able to add drawing files not attached as Xrefs that may also need purging without having to open them.

Figure 2 shows the dialog box, which serves to both adjust the purge settings and the method to purge additional drawing files that are not attached as Xrefs.

Figure 2: DWG-PURGE-BATCH dialog

As you can see in Figure 2, the DWG-PURGE-BATCH command is very robust in what it can purge and how.

The options for DWG-PURGE-BATCH include:

Select Drawings – where you can selectively add drawings files to be purged that are not currently attached as Xrefs.

Select Folder – makes adding other files easier. Instead of selecting individual files in a particular folder to purge, simply select the folder with the desired files, and then every DWG file in that folder will be added for purging.

Replace/Overwrite the Drawing – this radio button lets the command purge the current drawing and then save the drawing as normal.

Save to a Different Folder – if you want to leave your current file intact as is, this radio button allows you to save the drawing to a separate folder.

Add a Suffix – in addition and/or in conjunction to saving the additional drawings to a different folder, you can add a suffix to the new file name.

Save to Version – you have the ability to save the drawing file down to previous versions including 2010, 2007, and 2004 (for traditional AutoCAD, but not vertical applications such as Civil 3D).

Items to Purge – this is where you choose which items to purge.  As previously stated, you can purge the traditional AutoCAD items as well as DGN-related items, Registry Applications, and unused Annotation Scales.

DWG-PURGE Command Xref Purge Options – users should pay close attention to this. If your current drawing has a coworker’s drawing file attached as an Xref, they may not want their drawing purged.  This item has three options: “Always Purge Xref,” “Prompt Me to Purge Xref,” and “Never Purge Xref.” Hopefully, all are self-explanatory.

Purge – the Purge button only works once you have additional files loaded in the dialog box.

Close – once the purging exercise of additional files is complete (along with showing the purged results for each drawing file) you can click the Close button to exit the dialog box.

Where to Get it

You can download Drawing Purge from the Autodesk Exchange website: https://apps.exchange.autodesk.com/en and simply do a search for “Drawing Purge.”

How Much Does it Cost?

It is 100% FREE.  No trial periods, limitations, or ad-ware (which is especially nice).

How to Install it

Once you download the MSI file, simply close all Autodesk products you may have open and double-click on the MSI file. Once the routine has been installed, the DWG-PURGE and DWG-PURGE-BATCH commands will automatically be available for all the compatible software installed on your computer.

Appears in these Categories

Back