AutoCAD DGN Hotfix now available

I'm just back from a relaxing week spent in Ried-Brig and Valsesia, two very interesting – and in many ways similar – Alpine locations in Switzerland and Italy respectively. We were travelling with close friends of ours – she's from Ried-Brig, he's from Valsesia – which meant the week was packed with interesting (and usually "off the beaten track") activities. For instance, here's a panoramic photo I shot from the top of the Sacro Monte in Varallo.

Next week I'll be taking some time off to spend with old friends who are visiting from the UK, but in the meantime I have some things to catch up on.

One of the "good news" emails I had waiting for me this morning was from Albert Rius in Product Support. He has informed me that the AutoCAD DGN Hotfix is now available for download.

The hotfix contains two components, this time around: firstly it contains a clean-up tool – a .NET DLL built with the code provided in this post – but it also contains a fix to stop unwanted linestyles from being propagated via copy & paste or external referencing – a .DBX file to replace the one in the standard AutoCAD installation.

The clean-up tool – which defines the DGNPURGE command – should now deal properly with compound linestyles as well as clearing up some data that you'd otherwise have to use the standards PURGE command to remove (after having called DGNPURGE, of course).

According to the posted Readme, the updated AcDgnLS.dbx file – for which both 32- and 64-bit versions are available – is for AutoCAD 2013 and its verticals. It seems a fixed version of this module is to be included in an upcoming Service Pack for AutoCAD 2014, which presumably explains the fact only 2013 versions have been provided in this hotfix.

36 responses to “AutoCAD DGN Hotfix now available”

  1. Awesomesauce, it's all working. Superb tool!

  2. The old version worked fine. I cannot get the new DgnLsPurge.dll to load. Yes, I have "unblocked" it.

    I get this error:

    Assembly file name: C:Program FilesAutodeskAutoCAD Civil 3D 2013DgnLsPurge.dll Cannot load assembly. Error details: System.IO.FileLoadException: Could not load file or assembly 'file:///C:Program FilesAutodeskAutoCAD Civil 3D 2013DgnLsPurge.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

    File name: 'file:///C:Program FilesAutodeskAutoCAD Civil 3D 2013DgnLsPurge.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See go.microsoft.com/fwlink/?LinkId=155569 for more information.
    at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
    at System.Reflection.Assembly.LoadFrom(String assemblyFile)
    at Autodesk.AutoCAD.Runtime.ExtensionLoader.Load(String fileName)
    at loadmgd()

  3. Nevermind. I had to "Unblock" the ZIP file first, then extract the files. That seemed to do the trick.

  4. Will this work with AutoCAD 2012 and verticals? We are having similar problems.

  5. Kean Walmsley Avatar

    The hotfix DBX is for AutoCAD 2013 and the clean-up tool is for 2013-2014.

    But you could build the code for the clean-up tool into a DLL project (which doesn't reference AcCoreMgd.dll) that will work in prior releases of AutoCAD.

    Kean

    1. still not working for ACAD 2013. is there going to be an update for this? i have all the linetypes still.

      1. No update is currently planned. How is it failing - what does it report on the command-line?

        Kean

  6. Thanks Kean.
    greatly appreciated.

  7. There's a bug with this tool... I'm running it on a DWG file I have and it is crashing AutoCAD 2013 with a "eNullObjectId" error.

  8. Hi Samir,

    This is the first such report (which might indicate data corruption, given the length of time the tool has been available).

    Please email me a drawing and I'll take a look.

    Regards,

    Kean

  9. Hello Kean,

    Sorry for the delay, just sent you the email with the DWG file.

    I tested it with the last version of the code you posted, and then tested with the official DLL that I got from the hotfix, both of them are getting the error.

  10. Hi Kean,
    it was a good news, we tryed this tool - all works fine!

    But .. some of our team members marked, that
    thay don't like always use NETLOAD, and so on.

    I know, that is possible to make this tool autoload at AutoCAD startup.

    But is it possible to extend existing PURGE command with DGNPURGE functionality, like putting one more checkbox onto PURGE UI to ask user to run DGNPURGE before, in future AutoCAD releases I mean?

    Thank you.
    With regards.

  11. Hi Ruslan,

    This is definitely a short-term fix. Longer term you should expect to see something more integrated.

    Best regards,

    Kean

  12. chris@westernengineering.ca Avatar
    chris@westernengineering.ca

    How long is the tool supposed to take? I have a file that is 47Mb and when I run the command, AutoCAD just sits there and never seems to do anything. It doesn't crash, I don't get an error message or anything, it just freezes. I've waited over 10minutes before I give up and force close AutoCAD. Any thoughts?

  13. The time it takes will depend on the data (and how much RAM you have to load it into memory). The code runs through pretty much everything in a drawing to determine what can be removed.

    That said, it's also possible there's corruption in the drawing that causes a problem with the code. Have you tried running AUDIT or RECOVER on the DWG in question?

    Kean

  14. Same "eNullObjectId" error in my DWG file in Autocad 2014.

  15. The last person that had this error was using an old version of the tool. Please make sure you're using the one we posted to the web (or the code from the latest post).

    In case it's a new problem, email me a DWG that shows it.

    Kean

  16. Hi Kean

    I may not be able to mail the DWG file due to Companies confidentiality policy.
    Also i checked with the latest version of the tool posted on the web, which again gives the same error. But will again see to it,whether it solves the issue.

    Thanks
    With Regards.

  17. Hello Kean, please see my question on the Autodesk forum: forums.autodesk.com/t5/AutoCAD-Civil-3D-General/DGNPURGE-doesn-t-work-on-all-computers/td-p/4737589

    I can only get dgnpurge to work for a few people at my company.

  18. Why not just Export (File Menu) to Block?
    Overwrite the original then quit without saving. Make sure Model space USC is set to World.

    We have been using this method with excellent results in file size reduction, line type elimination and copy paste slow down issues.

  19. Each to their own. If this works for you, then great.

    A lot depends on what data you have in your DWG (paperspace layouts, etc.). Your approach is less targeted, but I'm happy it works well for you (and no doubt will for some others, too).

    Kean

  20. Hello Jason,

    Just found this in my blog's spam folder, in case you were wondering what happened to it. Thankfully we've connected via email in the meantime.

    Regards,

    Kean

  21. Can this be run on 2011 C3D? I'm unable to get it working following the steps on your site. Even following this link keanw.com/2011/07/loading-blocked-and-network-hosted-assemblies-with-net-4.html

  22. I think it could be made to work in Civil 3D 2011, although I haven't done so myself. You might try posting to the discussion groups - someone for there will almost certainly be able to help.

    Kean

  23. Christopher Severs Avatar
    Christopher Severs

    Thank you very much for this tool, I am excited for it's integration in 2015.

    I recently switched companies and I am having difficulty loading the dgn purge tool on my new computer. When I try to load it I get the following message:

    Cannot load assembly. Error details: System.IO.FileLoadException: Could not load file or assembly 'file:///C:Program FilesAutodeskAutodesk AutoCAD Civil 3D 2014DgnLsPurge.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

    File name: 'file:///C:Program FilesAutodeskAutodesk AutoCAD Civil 3D 2014DgnLsPurge.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See go.microsoft.com/fwl... for more information.

    at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

    at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

    at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

    at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)

    at System.Reflection.Assembly.LoadFrom(String assemblyFile)

    at Autodesk.AutoCAD.Runtime.ExtensionLoader.Load(String fileName)

    at loadmgd()

    Any suggestions?

  24. Christopher Severs Avatar
    Christopher Severs

    Thank you very much sir. My acad.exe.config is a little complicated due to all the add-on's I've got. The dgn purge tool seems to be working after applying your fix.

    1. Christopher Severs Avatar
      Christopher Severs

      My acad.exe.config file is too long to post here, but here is the truncated version:

      <configuration>

      <startup uselegacyv2runtimeactivationpolicy="true">

      <supportedruntime version="v4.0"/>

      </startup>

      <runtime>

      <loadfromremotesources enabled="true"/>

      <generatepublisherevidence enabled="false"/>

      <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">

      <probing privatepath="bin\FDO;bin;Plugins\Workflow\Activities;Bentley\WaterGEMS V8i;Bentley\StormCAD V8i;Bentley\SewerCAD V8i"/>

      <dependentassembly xmlns="urn:schemas-microsoft-com:asm.v1" provider="WaterGEMS V8i" version="8.11.5.61" installdate="2015-01-23T09:19:58">

      <assemblyidentity name="Bentley.ECObjects.2.0" publickeytoken="4bf6c96a266e58d4"/>

      <codebase version="2.0.0.0" href="file:///C:/Program Files (x86)/Bentley/WaterGEMS/x64/SharedAssemblies/Bentley.ECObjects.2.0.dll"/>

      </dependentassembly>

      """"

      ...

      </assemblybinding>

      <system.diagnostics>

      <sources>

      <source name="System.Windows.Data" switchname="SourceSwitch">

      <listeners>

      <remove name="Default"/>

      </listeners>

      </source>

      </sources>

      </system.diagnostics>

      </runtime>

      </configuration>

      1. Christopher Severs Avatar
        Christopher Severs

        Also, I've been reading your blog for a few years now, and just want to let you know it is an invaluable resource for all of us CAD users. Thank you for all your hard work.

        1. Thanks for the feedback, Christopher!

          Kean

  25. This worked miracles on my drawings! Thanks!

  26. Hi there,

    Sorry, I know this post is old but I thought perhaps someone can still help me:) I still use 2013.
    This tools used to work for me until today.

    A drawing I am trying to purge is about 10MB in size.
    I netloaded DGNPURGE and ran it.
    It spammed me with a message in addition to not clearing unreferenced strokes (111k):
    Unable to erase stroke (AcDbZombieObject): eNotAllowedForThisProxy

    So I applied the following work around:
    knowledge.autodesk.c...

    Now running DGNPURGE, i recieve and error message mentioned by a few others:
    "eNullObjectId"

    I found this site: knowledge.autodesk.c...

    I tried following but that fails also during the 2nd step (Import the DXF file in new file) with "DXF read error on line xxxx, Invalid or incomplete DXG input - drawing discarded"

    Any idea what can be done?

    Many thanks

    1. Mkk, so it appears to be a specific drawing that causes the "eNullObjectId" error. Any ideas where to go from here?
      Thanks,

      1. OK, I managed to overcome this issue. It was the combination of my first post.

        Hopefully it'l help someone in the same boat. Here is what i did:

        0. If during dgnpurge experiencing errors during:
        "Unable to erase stroke (AcDbZombieObject): eNotAllowedForThisProxy"
        follow: knowledge.autodesk.c...

        1. Opened the "bad" drawing
        2. Audit -> yes -> saved
        3. follow: knowledge.autodesk.c...

        4. dgnpurge should work now

  27. Aakanksha Jain Avatar
    Aakanksha Jain

    Hi Kean
    Ive tried doing this and it does no changes to my file, my 5mb file is still difficult to work with

    1. It's possible your problem isn't related to DGN linestyles. I suggest going through your standard support channels to get help with this.

      Kean

Leave a Reply

Your email address will not be published. Required fields are marked *