Author Topic: eDwgObjectImproperlyRead when reading PlotSettings from a Template  (Read 6252 times)

0 Members and 1 Guest are viewing this topic.

Chumplybum

  • Newt
  • Posts: 97
Re: eDwgObjectImproperlyRead when reading PlotSettings from a Template
« Reply #15 on: September 30, 2013, 07:11:59 PM »
the only issue I can think of (although fairly remote) would be someone else trying to access the database at the same time either via code or the editor... this would cause a read access exception

Jeff H

  • Needs a day job
  • Posts: 6150
Re: eDwgObjectImproperlyRead when reading PlotSettings from a Template
« Reply #16 on: September 30, 2013, 08:58:18 PM »
Also take a look at Autodesk.AutoCAD.DatabaseServices.FileOpenMode Enumeration   
If OpenForReadAndAllShare is used   
the docs say
Quote
   Open for read and allow read and write sharing (same as _SH_DENYNO). Using this value withDatabase.ReadDwgFile() allows other applications full access to the file when the file is opened by this call. This call will open a file for reading when the same file is already opened for writing.
Using this mode with Database.ReadDwgFile() does not lock out other applications from writing to the file. It is not safe to do a lazy load in such circumstances. Performing a lazy load means that pieces of the drawing are read-in only as needed. This feature, combined with the possibility of other applications updating the drawing file under this mode, can cause inconsistent reads and other errors. So, when Database.ReadDwgFile()> is used with this mode, ReadDwgFile will call Database.CloseInput() in order to fully read in the file and release the file handle (i.e. no lazy load). without the call to CloseInput().