Monday, June 24, 2013

How to purge DGN linetypes in DWGs

Have you problem with DWG files that have become bloated while copying and pasting from DWGs containing DGN linetypes of MicroStation origin or after using DGNIMPORT?

AutoCAD DGN Clean-up Tool can be downloaded here and help you out.
UPDATE: The download is not available as Autodesk is working on a bug fix.

This Hotfix applies to AutoCAD 2013, Autodesk AutoCAD 2014, and related vertical products.

Here’s the most important parts from the readme:

Installation and Execution Instructions

1. Close all software applications.
2. Download the Hotfix (AutoCAD_2013_2014_DGN_CleanUp_Tool.exe) to a location on
your local computer.
3. To install the fix, double-click the ZIP executable and save the file to the product
installation folder (for example C:\Program Files\Autodesk\AutoCAD 2013).
(My comment: As far as I can see the DLL don’t have to be in the product installation folder, I tried to put it in c:\temp and it worked just fine)

To Execute This Hotfix
1. Start up AutoCAD.
2. Netload DgnLsPurge.dll.
3. Open the affected drawing file.
4. Run the DGNPURGE command to make the elements purge-able.
5. PURGE.
6. Repeat steps 4-5 if needed.
7. Save the DWG.
8. Repeat steps 3-7 for other affected files.

Here is what it can look like when running DGNPURGE:
Command: DGNPURGE
Purged 18 unreferenced complex linetype records (of 20).
Purged 155 unreferenced strokes (of 157).

But the current version of DGNPURGE seems to be affecting lines that are using DGN linetypes too in some cases. Compare with the image above.

Autodesk is now aware of that compound linetypes are not handled properly and is working on an update of the tool.

If you want to purge many drawings our SmartPurger can be used to automate the work. Here is an example of what the AutoLISP code would look like. Note that even though SmartPurger runs a purge the LSP is loaded after so we need to run purge through the LSP instead. If you like you can change the number of times this is repeated. Right now it is 3 times. Edit the path as needed and remember to use \\ instead of \.

(command "._NETLOAD" "C:\\Temp\\DgnLsPurge.dll")
(repeat 3
  (command "._DGNPURGE")
  (command "._PURGE" "_A" "*" "_N")
)

For technical details around purging traces from DGN linestyles see this post on Through the Interface.

Complex DGN linestyles – that presumably cannot be mapped directly to standard AutoCAD linetypes – have entries in their Extension Dictionaries named “DGNLSDEF”. These objects contain references to objects in the “ACAD_DGNLINESTYLECOMP” dictionary (which is inside the root Named Objects Dictionary).

The objects in this dictionary represent the “strokes” in the linetype. They might be simple (in the case of STROKE1, above) or more complex. Complex strokes can refer to each other and also to anonymous blocks in the Block Table.

UPDATE: Details about the issues found in the first release and source code for the fix.

No comments:

Post a Comment

Subscribe to the comments feed

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner

Contact Us | About JTB World | Subscribe to this blog
JTB World's website | Website General Terms of Use | Privacy Policy
^ Top of page

© 2004- JTB World. All rights reserved.