.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Different ways of reading a document database

3 REPLIES 3
Reply
Message 1 of 4
DiogoSantos
331 Views, 3 Replies

Different ways of reading a document database

Hello,

 

I'm getting a problem regarding getting a document database. I've tested two alternatives:

Alternative1

doc = autoCadApp.DocumentManager.Open(fullpath);
autoCadApp.DocumentManager.MdiActiveDocument = doc;
doc.LockDocument(DocumentLockMode.Write, null, null, false);

Database db = doc.Database

 

Alternative2

Database db = new Database(true, false);

db.ReadDwgFile(fullpath, FileShare.ReadWrite, false, string.Empty);

 

Because what I'm trying to do is modify the xref path of documents, and when i detach the xref and then attach the newer xref, if i access the database from the alternative 1, I don't get any error and the xref is updated correctly. But when I use the alternative number 2, when I attach a newer xref i get and ePermantlyErased exception. Shouldn't that be the same? By the way, I need to open the document silently that is why I'm using alternative number 2.

 

 

Thanks and kind regards,

Diogo

3 REPLIES 3
Message 2 of 4
Ed.Jobe
in reply to: DiogoSantos

post your code for alt 2

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 3 of 4
DiogoSantos
in reply to: Ed.Jobe

Hello,

 

I was doing something wrong, I've already corrected it.

Besides doing the code of alternative 2, i was still openning the document, and for that i was getting exceptions related to conflicts.

 

Thanks anyway.

 

Diogo

Message 4 of 4
Ed.Jobe
in reply to: DiogoSantos

I figured it was something like that.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost