CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT - CZ | SK | EN | DE
Over 1.092.000 registered users (EN+CZ). AutoCAD tips, Inventor tips, Revit tips. Try the new precise Engineering calculator. New AutoCAD 2026 commands and variables.

CAD tip CAD tip # 9553:

Question

CAD 
 %  platform  category 
A
Most AutoCAD users probably know the command PURGE for removing unused definitions of blocks, styles, lineptypes, dimension styles, etc. from a DWG file.

If you need to automate purging in your drawings, you can use a simple menu macro (to assign to a button click in your ribbon) or a script. For this, you will use the commandline version of the Purge command, i.e. -PURGE. Remember that not all tables and objects are purged with the option "All", so you will need to separately invoke purging of some special objects (registered applications, zero-length geometry, empty texts). Another special type of object are the DGN linetype definitions - there is a special DGN-hotfix for them (see DL Download) with the command DGNPURGE. Due to possible nested objects, it is advisable to repeat the purging process a couple of times.

Then the resulting script for purging really all excessive unused objects and definitions from the current DWG drawing looks like this:

  
_NETLOAD DGNLSPURGE.DLL  
DGNPURGE  
_-PURGE _REGAPP * _N  
_-PURGE _ZERO  
_-PURGE _EMPTY  
_-PURGE _ALL * _N  
DGNPURGE  
_-PURGE _ALL * _N  
DGNPURGE  
_-PURGE _ALL * _N  

Except DGNPURGE, you can perform this purging also in AutoCAD LT. You can also use this script to batch-purge drawings with ScriptPro.

UPDATE: Since version 2015 you can use _-PURGE _Orphaned instead of loading and calling DGNPURGE.

Please note that all these purge commands can be executed - e.g. with a .SCR script - also in the console (non-graphical) version of AutoCAD, AcCoreConsole.exe. See the Tip 8552.

ACADACLTADTACADMCivilMapPlant
100% *CAD
19.11.2013    37802×  
Share the tip:
Digg it! Del.icio.us Facebook Twitter Google bookmark Technorati StumbleUpon

See also:
Tip 14477:PurgeAll - automation of DWG file cleaning
Tip 14402:What is the difference between the BLOCKREPLACE, BREPLACE, REPLACEBLOCK, RIBLOCK and BLKREDEF commands?
Tip 14333:A free tool for bulk-purging of DWG drawing files.
Tip 13675:Two PURGE commands in Autodesk Civil 3D.
Tip 12933:Purging small objects from a DWG drawing - PurgeSmall.


Back    All CAD Tips



Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD: 
OS: 
Categ: 
Text:
 FAQ
  



Featuring:
Publish interactive 3D PDF models from AutoCAD, Inventor or Revit with Share3D More info


Please use these tips at your own risk.
ARKANCE is not responsible for possible problems that may occur as a result of using any of these tips.
TOPlist