AutoCAD Vb net Use "Application.DocumentManager.MdiActiveDocument.Database" in an external program?

AutoCAD Vb net Use "Application.DocumentManager.MdiActiveDocument.Database" in an external program?

vpeuvion
Advocate Advocate
1,790 Views
2 Replies
Message 1 of 3

AutoCAD Vb net Use "Application.DocumentManager.MdiActiveDocument.Database" in an external program?

vpeuvion
Advocate
Advocate

Hello,
I would like from an external VB net program to open a dwg file with AutoCAD, select all entities and create a block.
I have never done development with AutoCAD and after doing some research on the net, I found some examples of connections to AutoCAD with an internal program.
It's quite confusing for me, I feel like the possibilities are limited with an external program.
Until now I manage to open the file but as soon as I try to work on the drawing I get stuck.
I have the impression that some references cannot be used with an external program.
Is it possible to use "Application.DocumentManager.MdiActiveDocument.Database" in an external program?
Is it possible to make transactions in an external program?
Is what I want to do possible? What references can I use in Visual Studio for an external program?
Any help would be appreciated.

Thanks. Vincent.

0 Likes
Accepted solutions (1)
1,791 Views
2 Replies
Replies (2)
Message 2 of 3

Norman_Yuan
Mentor
Mentor
Accepted solution

1. Yes, your suspicion is right: AutoCAD .NET API assemblies cannot be used with your external EXE app (thus any references in your external app's code to namespace/classes from AutoCAD .NET API assemblies would cause error when running.

 

2. You can only use AutoCAD COM API to automate AutoCAD from your external app. Since you use .NET to develop your EXE, you need to use AutoCAD's COM interop assemblies (Autodesk.AutoCAD.Interop/Common.dll).

 

3. More importantly, you want to think hard about why you want to automate AutoCAD from an external app. This kind of application can hardly be a good business solution in most, if not all, cases. Especially, if your app is meant to be run by a user: why the user has to face 2 applications (AutoCAD and your app) running the same time? Not to mention the slowness caused by the communication between your app and AutoCAD, the troubles you may have to handle when AutoCAD version changes...

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 3

vpeuvion
Advocate
Advocate

Hello @Norman_Yuan ,
Thank you for your very clear answer and your recommendations.
I understand better now.

Regards. Vincent.

0 Likes