.NET

Reply
*Expert Elite*
Alfred.NESWADBA
Posts: 9,378
Registered: ‎06-29-2007
Message 11 of 13 (226 Views)

Re: Autocad busy

11-28-2011 04:33 AM in reply to: stuartnathan

Hi,

 

>> I get a file sharing error.

Have you got the message more detailed? Does the message show a filename that it struggles with?

Could that be that you get this message when opening a DWG-file more than once and forgot to .CloseInput or .Dispose the DB-object?

 

And just to understand your situation: You have 2 VS-projects, one that starts AutoCAD with "...createObject" and the other as DLL that is _NETLOADed into AutoCAD?

 

>> which I do by sending message to acad

Why that?

If you created an AutOCAD process with CreateObject, you have the AcadApplication-object (COM) and so you have the AcadDocument-object (COM) and one step more you can use the SendCommand without using Windows-messaging (I would see SendCommand as more save).

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Valued Contributor
stuartnathan
Posts: 70
Registered: ‎02-17-2005
Message 12 of 13 (218 Views)

Re: Autocad busy

11-28-2011 03:36 PM in reply to: Alfred.NESWADBA

I have a number of projects in the VS solution.

One is a Library of various functions, classes etc. which is used by other projects.

One is a library of my own controls

One is the exe file

One is a class which wraps around loading AutoCad's different versions. It uses Com to load a hidden version of AutoCad. It also provides a way for the exe file to know of changes inside AutoCad.

and

One is an independant class that loads as an inprocess class. It provides various functions such as reading title sheets, as well as block and layer manipulation. It effectively adds my Commands to AutoCad.

Following your advice, the function that reads title sheets does this using the database and not the editor. It now (thankyou) works faultlessly when called inside AutoCad.

 

But if I invoke it from my exe. I get this error:-

 

Autodesk.AutoCAD.Runtime.Exception: eFileSharingViolation    at Autodesk.AutoCAD.DatabaseServices.Database.ReadDwgFile(String fileName, FileOpenMode mode, Boolean allowCPConversion, String password)    at om2011net.clsAcad.OMREADTITLES() in D:\Visual Studio 2008\Projects\Acadnet2011\clsAcad.vb:line 374    at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction)    at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction)    at Autodesk.AutoCAD.Runtime.PerDocumentCommandClass.Invoke(MethodInfo mi, Boolean bLispFunction)    at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke()

 

Furthermore, nothing was written to an external file, so it hasn't even got into the routine.

 

 

*Expert Elite*
Alfred.NESWADBA
Posts: 9,378
Registered: ‎06-29-2007
Message 13 of 13 (208 Views)

Re: Autocad busy

11-29-2011 12:44 AM in reply to: stuartnathan

Hi,

 

this part of the exception-message:

eFileSharingViolation    at Autodesk.AutoCAD.DatabaseServices.Database.ReadDwg

gives you a lot of info and I would guess that you open a file that is already open (or at least that was opened but not closed afterwards). I think that you should verify the workflow in your app .... where and when does your app open a database (of have already anyone open), could it be that the list of files you work through contains double filesnames ... or whatever ==> for analyzing that you must have your code, I can't do that for you, sorry!

 

Good luck, - alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!