0

I seem to have issues sometimes opening a drawing database. In the past, I used: MyDb.ReadDwgFile(DrawingName, IO.FileShare.ReadWrite, True, Nothing), with the IO.Fileshare.ReadWrite being the point of interest. But, I started having issues with it when I moved to Design Automation. I Later, I found a different file open mode enum of FileOpenMode.OpenForReadAndAllShare and started using it.

I understand both enums are from different libraries (system.io vs autodesk.autocad.databaseservices), but why do I have off and on success using one versus the other? Could it be because of the .dwg version, or because AEC libraries are being loaded? I switched to the autodesk enum and was having success for a while, but now I have some files that pass though and others that don't. For right now, my plan is to try one, check for a failure, then try the other. Is anybody else running into this?

1 Answers1

0

I don't think this is specific to Design Automation. I think the same DWG file will behave the same on your machine too. I suspect what's going on is that you have some unreadable objects in the drawing. ReadWrite will engage the "lazy loading" code path: only the objects that you open are loaded from disk. "...AllShare" will load every object from disk since you want others to be able to access the drawing simultaneously.

Albert Szilvasy
  • 461
  • 3
  • 5
  • First, thanks for explaining the difference; I didn't know that. But I've been using ReadWrite for a decade now, and don't have issues with it on the same drawings I'm running through DA. I only switched to AllShare because of issues using ReadWrite in DA. Right now, I've placed a Trace statement before and after each approach, the first being caught in a Try-Catch, the second in the Catch. I'll post the results after I run it. – Charles Dodson Jun 10 '20 at 18:26
  • Well, the Try-Catch crap didn't work very well, but recognizing I had grabbed an updated set of drawing to work with this morning, I decided to investigate them per your suggestion, and yeah, there was a butt load of crap in them. Anyway, thanks for the tip. – Charles Dodson Jun 11 '20 at 21:47