Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Help to reduce the size of a DWG file?

Dear engineers, please tell me how you reduce DWG file size? What techniques using? What tips can give? (command 'purge' does not offer)

user-image
Question added by Deleted user
Date Posted: 2015/05/06
Muhammad Shakeel
by Muhammad Shakeel , CAD Design Manager , M/S zeeruk Intl.

Read this Artical for DWG Large File.

While I generally find my own motivations in life aligned with Isaac Asimov’s quote which declares that “the true delight is in the finding out rather than in the knowing“, there have been times troubleshooting certain issues where I found myself wishing I just knew what was wrong.

One such recent issue involved multiple clients all of whom exhibited the same mysterious crisis: having a user base working with DWG files that kept getting increasingly larger. At a cursory glance, there seemed to be nothing wrong with these drawings. Audits came up clean. Purging did nothing to reduce the file size. Even blocking out the drawing into a clean template made no difference. All this to say that I found myself asking what could be possibly done to not only identify this problem but resolve it once and for all?HOW BIG IS BIG?Identifying certain characteristics of a problem usually helps single out its cause, much like I imagine a doctor’s diagnosis would be based on a patient’s symptoms. Examining a sample drawing that a client sent me, I noticed what appeared to be a small drawing with very little line work weighing in at7.38MB. As I previously mentioned, I went through what I consider due diligence whenever troubleshooting an issue related to mysterious drawing behavior; checking the number of scale lists (SCALELISTEDIT), ensuring that there aren’t excessive registered applications (REGAPPS), purging any unused styles (-PURGE), and auditing the file for corruption (AUDIT), however none of these methods resolved the bloat problem nor did they identify the source of the cause.

THINKING OUTSIDE THE BOXOne of the benefits of being a long time Civil3D user is knowing about some of the built-in Map3D Features that enable users to attach an existing drawing to an a empty file as a database. Using this feature one can define and execute queries related to objects in an existing drawing and then draw them in a new one. This is usually my go-to step in fixing drawings and sure enough going through this process reduced the file size tremendously. This allowed me to assist our clients by cleaning one or two problematic drawings, but did nothing to allow users to help themselves, mostly since this problem seemed to happening exclusively to our architectural clients who typically don’t have a license of either Civil3D or Map3D.

It was through some extended dialog with the client that the next piece of the puzzle fell into place, namely the indication that when opening one of the affected drawings in an earlier version of AutoCAD (2010 to be exact), a proxy warning dialog window appeared. When examined, the dialog window finally gave us the lead we needed.

PROXY WARproxy-dialog-windowLooking at the sample dialog window to the left you will see a very large number of proxies, approximately two hundred thousand, which would explain the excessive bloating seen in the file size. The proxy warning targeted the missing application as AcDgnLS, which exposed that the offending objects likely came from Microstation (the tell being that Microstation files are designated with a DGN extension). Further research would later precisely target DGN LineStyles . For an extensive understanding of the underlying purpose of these proxies, please read Kean Walmsley’s Through the Interface post named Purging unwanted DGN linestyle data from an AutoCAD drawing using .NETand all its derivative posts located at the end of the article.

While this at least revealed the problem , it still left me with no readily accessible tool to rid the drawing of these proxies. Opening a case with the Autodesk support team confirmed this fact and at the time the case was open, the only strategies were the previously mentioned workaround using Civil3D/Map3D as well as two other alternatives, the first using DXFOUT/DXFIN and the second utilizing AutoCAD2010.

THE FIXFortunately, as of August2nd,2013 the AutoCAD DGN hotfix has come out that specifically addresses this issue. In summary all that is required is replacing a file in the root of the application folder (AcDgnLS.dbx) and then running AutoCAD and using the NETLOAD command to load a DLL (DgnLsPurge.dll). Once the DLL is loaded, type inDGNPURGE at the command line and press RETURN to purge out the objects causing file bloat. As a benchmark, I performed the purging process on a client’s file and it took2 minutes10 Seconds to clean. Below is a typical message that is displayed after the purge is complete (total number of purged objects will vary).

DGN Purge

 

 In addition, I would suggest running a -PURGE command to purge REGAPPS and ALL as well as using the AUDIT command. Combined with the DGNPURGE, those actions reduced the sample file down from8.8MB to1.3MB. In another instance with a different client’s file, the purging process reduced a drawing to less than1% of its original size, from7.5MB to .062MB.

According to the hotfix, computers patched with the new DBX file “will also prevent future occurrences of the file bloat issue from occurring” so it’s imperative that every user is patched and that any drawings coming from outside consultants are cleaned up before being inserted into your own projects.

EPILOGUEIf you want to incorporate the NETLOAD of the DGNLSPURGE.DLL command into your start up lisp routine so it loads on every workstation once you’ve rolled out the DBX file firm-wide, you can add the following code to your acad2014.lsp (or acad2013.lsp) as it runs the first time AutoCAD is launched and will allow you to run the DGNPURGE command without manually loading the DLL first.

(command “netload” “C:\\\\Program Files\\\\Autodesk\\\\AutoCAD2014\\\\DgnLsPurge.dll”)

Lastly, I have seen some clients run the DGNPURGE command and have error messages appear, such as the following:

  • Unable to erase stroke (AcDbZombie Object): eNot Allowed For This Proxy
  • Cannot load assembly. Error details: System.IO.FileLoadException: Could not load file or assembly ‘file:///C:\\Program Files\\Autodesk\\AutoCAD2013\\DgnLsPurge.dll’ or one of its dependencies. Operation is not supported

The solution for both these messages was to force load the AcDgnLs.dbx file by adding it to the Startup Suite. After doing so the DGNPURGE command worked as expected.

EDIT01 (09/03/13)As of September3rd, Autodesk has released an additional Hotfix for AutoCAD2012 and related vertical products.

EDIT02 (09/10/13)If you have followed my suggestion above regarding loading the DgnLsPurge DLL automatically and would also like to run DGNPURGE on every drawing you open to help “automate” the cleaning process, I would suggest adding the following code to the end of your acad*doc.lsp (where the asterisk pertains to the release year e.g.2014) as this lisp runs the every time an AutoCAD drawing is opened. NOTE: This will slow the opening process for affected drawings as it will launch into the purge command every time it encounters a corrupt drawing (it can take several minutes). Once a drawing is cleaned, subsequent opens will be as quick as they were before adding the code since the purge process returns0 linestyles to clean out.

;;;;;; Run DGNPURGE to clean drawings when opened;;;(command “DGNPURGE”)

Ali Mohamed Ahmed
by Ali Mohamed Ahmed , site engineering , شركة مقاولات

I think the answer Mr.Muhammad Shakeel  answer successful and do not need to add

Amr Gamal Anwar Hassan
by Amr Gamal Anwar Hassan , مهندس حاسب كميات , Shurfah Real Estate Development and Investment

Thank you for the invitation

I do not have more information about this question

but I agree the answer of Muhammad Shakeel

Deleted user
by Deleted user

Agree with my colleagues 

Thanks 

Syed Shan Haider
by Syed Shan Haider , Senior Draftsman , Al Marwan General Contracting Company

Thank You for Invitation...

 

 

AutoCAD DWG files unexpectedly increase in file size Nov3,2014

 

Applies to AutoCAD2012, AutoCAD2013, AutoCAD2014, AutoCAD2015, AutoCAD Architecture2012, AutoCAD Architecture2013, AutoCAD Architecture2014, AutoCAD Architecture2015, AutoCAD Civil3D2012, AutoCAD Civil3D2013, AutoCAD Civil3D2014, AutoCAD Civil3D2015, AutoCAD Electrical2012, AutoCAD Electrical2013, AutoCAD Electrical2014, ... See More

Issue:

Drawing files in AutoCAD end up being much larger than they should, often with no obvious data in them. Other symptoms include: 
  • Failure to copy and paste elements.
  • Hanging for a long time when selecting text with the properties palette open.
  • Drawing file takes a long time to open.

Causes:

This happens when data is imported from a DGN file and the original linetypes were not mapped or were incorrectly mapped to AutoCAD linetypes. This produces a huge object database in the drawing that cannot be purged with the standard tools. Furthermore, if you copy and paste an entity from an affected drawing into another drawing, the entire database is also copied and the problem is spread to the other file.

Solution:

Open affected drawings in AutoCAD2015 (or a later version) and use the PURGE command. Be sure to enable the checkbox labeled "Automatically purge orphaned data." For AutoCAD2012,2013, and2014, there is the DGN Hotfix.  AutoCAD DGN Hotfix for AutoCAD2013/2014 AutoCAD DGN Hotfix for AutoCAD2012 The purge feature in AutoCAD2015 was added to as a result of the hotfix being rolled into the program, with enhancement (i.e., it is better than the hotfix). The hotfix includes two files: 
  • DgnLsPurge.dll. Once loaded, it allows you to purge DGN objects using the DGNPURGE command. 
  • AcDgnLS.dbx. This keeps the DGN objects from propagating to new files when copying, pasting, or inserting from other files.
Refer to the associated readme files for instructions. Most likely the hotfix files will need to be unblocked in order to work and there is a screen shot about this in the readme. To use, enter the DGNPURGE command on the command line in AutoCAD to remove unwanted DGN elements. It gives no feedback until done, so on very big files you will simply need to wait until it is finished, which could take several minutes. After it is done, use PURGE > All on the drawing. The large file size problem is partially solved with Service Pack1 for both AutoCAD2014 and AutoCAD LT2014, stopping the propagation of unwanted line types between files. The service pack does not contain the DGNPURGE command, which is needed to clean already affected files. Using DGNPURGE on multiple files at once There is a third-party plug-in called Drawing Purge that can be added to AutoCAD which will let you purge multiple drawings all at one time. AutoCAD LT and the DGN Hotfix AutoCAD LT does not have the NETLOAD command which is needed to load the hotfix DLL file, which means the DGNPURGE command is not usable within AutoCAD LT. However, AutoCAD LT2015 has the enhanced PURGE functionality, so it is recommended to use version2015 to purge files. As an alternative to the hotfix, converting a DWG file to DXF and then back again, or to DGN and back, or using WBLOCK to write a new file has the potential to remove unwanted DGN elements. DXFOUT to remove line types
  1. Open the file with AutoCAD LT.
  2. DXFOUT the full file.
  3. In a new file DXFIN the file created in previous step.
  4. After importing the DXF, generate a new DXF file (DXFOUT).
  5. In a new file DXFIN the file created in previous step.
  6. Purge all.
  7. Save the file.
WBLOCK to remove line types
  1. Open the file with AutoCAD LT.
  2. Enter the WBLOCK command.
  3. Select the "Entire drawing" option.
  4. Click the location button at the bottom-right to name the file and pick a location to save to.
  5. Click OK.

DGNEXPORT to remove line types:

  1. Open the affected drawing file using AutoCAD LT.
  2. Enter DGNEXPORT at the command line.
  3. Select V8 DGN under 'Files of type' and click Save.
  4. When the Export DGN Settings message box is displayed, verify that the correct seed file and units are selected.
  5. Click OK.
  6. After the DGN export is complete, open a new template and enter DGNIMPORT at the command line.
  7. Select the newly created DGN file and click Open.
  8. Verify that the Conversion unit is correct.
  9. Click on Mapping setups and select new and make sure Mapping type is Import.
  10. On the new Mapping setup, click on Modify.
  11. Go to the Linetype tab, change all rows to ByLayer (right-click on the first row which has been set to ByLayer and the select Copy, then select all the rows and right-click > paste).
  12. Click OK.

COPY and PASTEIf you have installed Service Pack1 for AutoCAD and AutoCAD LT 2014, try the following procedure if previous methods fail:

  1. Open the DWG file.
  2. With the LAYER command, assure that all layers are on, thawed, and unlocked.
  3. Copy all objects in the drawing to the clipboard (CTRL+A then CTRL+C).
  4. Open a new file and paste all copied objects (CTRL+V).
  5. Save the file.

See Also:

How to clean DWG files from the extra DGN linetypes with AutoCAD2015 Copy and paste in AutoCAD hangs for a long time or fails to work Some DWG files cannot be purged with DGNPURGE in AutoCAD

Glenn Philip Zamora
by Glenn Philip Zamora , BIM Architect , Architectural and Landscaping

Use command audit then purge the file

More Questions Like This