Accessing .NET commands from outside of AutoCAD

Accessing .NET commands from outside of AutoCAD

Anonymous
Not applicable
761 Views
1 Reply
Message 1 of 2

Accessing .NET commands from outside of AutoCAD

Anonymous
Not applicable

So over the past couple of years I have started to dabble in visual basic code. I created an access database to control our 7,000+ AutoCAD piping isometric drawings. This access database will open the drawing, save revisions, index specific blocks and all of their attribute information, allows non-AutoCAD users to update titleblock information to the correct block attribute tag, and other tricks. One of the biggest features of this Access database is that it allows users to submit a drawing for revision and "Attach" (Not in the database, but they think that it is) any red lined drawings to support the changes. This gives the AutoCAD personnel a prioritized list of revisions to work on next. So with that out of the way let me get to where I am having trouble. 

 

There are not any problems with the current access database frontend, but there are limitations to access frontends. One of the biggest seems to be keeping the frontend up to date. I have implemented a check at open to keep it up to date, but Visual Studio windows forms with Click-once seems to do a better job. So, I have created a new front end for the access database. That is running great, just without the AutoCAD functionality that I had built in to the Access database frontend.

 

***Problem Description starts here***

I am trying to get around coding for multiple versions of AutoCAD. I accomplished this for the access database version through late binding, but I would like to get away from this. I have created an AutoCAD custom commands dll which has been NETLOAD'd and works from within AutoCAD to run commands. This has been added to the AutoCAD registry and starts up when AutoCAD opens. Is there a way to access these commands from the windows forms application. I would like to be able to capture the AcadApplication and AcadDocument events from the windows forms application. If not there, then capture the events from the AutoCAD custom commands dll and perform the actions there. 

 

What I am really looking for is guidance. I have been working in circles for a while now and not really sure what to try next. Thanks for your help in advance.

0 Likes
762 Views
1 Reply
Reply (1)
Message 2 of 2

ActivistInvestor
Mentor
Mentor

@Anonymous wrote:

 


***Problem Description starts here***

I am trying to get around coding for multiple versions of AutoCAD. I accomplished this for the access database version through late binding, but I would like to get away from this. I have created an AutoCAD custom commands dll which has been NETLOAD'd and works from within AutoCAD to run commands. This has been added to the AutoCAD registry and starts up when AutoCAD opens. Is there a way to access these commands from the windows forms application. I would like to be able to capture the AcadApplication and AcadDocument events from the windows forms application. If not there, then capture the events from the AutoCAD custom commands dll and perform the actions there. 

 

What I am really looking for is guidance. I have been working in circles for a while now and not really sure what to try next. Thanks for your help in advance.


You can also build a COM server that can be loaded into AutoCAD via the GetInterfaceObject() method of the AcadApplication, and you can talk to it from another process (e.g., your WindowsForms application that runs as a standalone .EXE). The COM server can use the AutoCAD managed API, and can service an out-of-process client, such as your standalone WindowsForms application.

 

This article should help explain how its done.

 

Handling events in an out-of-process client is probably not a good choice, especially if you have an in-process COM server as I describe above. The overhead of the events having to go across process boundaries can have a noticeable impact on performance, depending on what events are involved.

0 Likes