.NET

Reply
Contributor
DiogoSantos
Posts: 17
Registered: ‎06-19-2012
Message 1 of 4 (145 Views)

Different ways of reading a document database

145 Views, 3 Replies
06-20-2012 01:38 AM

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

Distinguished Contributor
eljobe
Posts: 704
Registered: ‎01-24-2003
Message 2 of 4 (128 Views)

Re: Different ways of reading a document database

06-20-2012 07:39 AM in reply to: DiogoSantos

post your code for alt 2

Contributor
DiogoSantos
Posts: 17
Registered: ‎06-19-2012
Message 3 of 4 (124 Views)

Re: Different ways of reading a document database

06-20-2012 07:44 AM in reply to: eljobe

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

Distinguished Contributor
eljobe
Posts: 704
Registered: ‎01-24-2003
Message 4 of 4 (122 Views)

Re: Different ways of reading a document database

06-20-2012 07:46 AM in reply to: DiogoSantos

I figured it was something like that.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community