Microstation Connect Update 16.
Is there a right method or constructor to use if you want to load the dgn file into memory without opening it? I see that DgnDocument has some "Create" methods but they seem to relate to creating a new document, then there's also DgnFile.Create methods which are asking for a DgnDocument to be passed in. Session.Instance.NewDesignFile() actually opens the file and I don't see an override to open it "forprogram" sort of like in the interop.
Thanks.
I was able to load it with some help from other threads:
DgnDocument dgnDocument = DgnDocument.CreateForLocalFile(file); DgnFileOwner dgnFileOwner = DgnFile.Create(dgnDocument, DgnFileOpenMode.ReadOnly); var dgn = dgnFileOwner.DgnFile; StatusInt status; dgn.LoadDgnFile(out status);
Viktor_Kulik said:I was able to load it with some help from other threads:
Yes, it is the right solution.
In more correct form:
using (DgnDocument document = DgnDocument.CreateForLocalFile(filename)) using (DgnFileOwner owner = DgnFile.Create(document, DgnFileOpenMode.ReadOnly)) { DgnFile dgnFile = owner.DgnFile; StatusInt openForWriteStatus; DgnFileStatus loadStatus = dgnFile.LoadDgnFile(out openForWriteStatus); if (loadStatus == DgnFileStatus.Success) { // ... } }
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Thanks Jan, yea I'll be using the usings