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

Is it possible to call parts of the AutoCAD API outside of AutoCAD?

6 REPLIES 6
Reply
Message 1 of 7
adnamin
396 Views, 6 Replies

Is it possible to call parts of the AutoCAD API outside of AutoCAD?

Hello,

I have an AutoCAD plugin that works well. However, I have some clients that would like to call the plug-in functionality from outside AutoCAD. Thus, I have created a wrapper interface around my plug-in, though internally, it still relies on some AutoCAD .dlls. However, when I try to run an application that uses the wrapper interface, I get all sorts of errors (in particular, it seems that some needed assemblies are not found at runtime). Is there a way to make this work or is it just impossible to use AutoCAD dlls from outside AutoCAD?

Thanks.
6 REPLIES 6
Message 2 of 7
adnamin
in reply to: adnamin

To elaborate, I get many errors of the form: The type initializer for '' threw an exception.
Message 3 of 7
adnamin
in reply to: adnamin

I actually understand why I got that error. But I am getting lots of:
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Autodesk.AutoCAD.DatabaseServices.DBObject.DeleteUnmanagedObject()
at Autodesk.AutoCAD.Runtime.DisposableWrapper.Dispose(Boolean disposing)
at Autodesk.AutoCAD.Runtime.DisposableWrapper.Finalize()
at Autodesk.AutoCAD.DatabaseServices.DBObject.Finalize()

I thought that I use supposed to dispose of DBObjects that are temporary? The funny thing is if I dispose properly of it, then it seems the error gets generated. Does the disposing behave differently if we're outside of AutoCAD?
Message 4 of 7
Anonymous
in reply to: adnamin


AutoCAD's assemblies can't be loaded into another
process.

 

It has to be a DLL. If you want to talk to your plugin
from

another process you would need to use COM
size=2>.


 

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000
through 2009

href="http://www.acadxtabs.com">http://www.acadxtabs.com

 


 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Hello,
I have an AutoCAD plugin that works well. However, I have some clients that
would like to call the plug-in functionality from outside AutoCAD. Thus, I
have created a wrapper interface around my plug-in, though internally, it
still relies on some AutoCAD .dlls. However, when I try to run an application
that uses the wrapper interface, I get all sorts of errors (in particular, it
seems that some needed assemblies are not found at runtime). Is there a way to
make this work or is it just impossible to use AutoCAD dlls from outside
AutoCAD? Thanks.
Message 5 of 7
adnamin
in reply to: adnamin

Thanks, Tony.

So let's have I have a plug-in written in a mixture of C++ and .NET. Can I write a wrapper interface to the plug-in that I could call from another application? You said to use COM, could you elaborate on the steps I need to take? Would that mean that the AutoCAD + plugin application would need to be running in order for the other application to call it?
Message 6 of 7
Anonymous
in reply to: adnamin


AutoCAD's ObjectARX Wizard can create a skeleton for
a

an ARX library that can act as a COM
server.

 

You implement the COM server and interface, and
then

from another process you can connect to AutoCAD's

ActiveX API, and use the GetInterfaceObject()
method

of the AutoCAD Application object to load the COM

server into AutoCAD's process.

 


 

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000
through 2009

href="http://www.acadxtabs.com">http://www.acadxtabs.com

 


 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Thanks,
Tony. So let's have I have a plug-in written in a mixture of C++ and .NET. Can
I write a wrapper interface to the plug-in that I could call from another
application? You said to use COM, could you elaborate on the steps I need to
take? Would that mean that the AutoCAD + plugin application would need to be
running in order for the other application to call
it?
Message 7 of 7
djonio
in reply to: adnamin

adnamin,

No, not that I am aware of. But you certainly can communicate with a NETLOADed module from outside of AutoCAD. Here is an alternative for you to try. This is a complete zipped up VS2005 solution in c#: http://topologyframework.blogspot.com/2008/11/simple-named-pipes-solution-for.html

Just does a "SendStringToExecute" but you will get the idea.
r,
dennis

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