creaing a net dll for AutoCAD and call from COM exe

creaing a net dll for AutoCAD and call from COM exe

dnl999
Advocate Advocate
1,302 Views
7 Replies
Message 1 of 8

creaing a net dll for AutoCAD and call from COM exe

dnl999
Advocate
Advocate
I am sure this has been discussed before, but I can't find any solid answer after doing some search.
I found many samples for creating a net dll which uses the new AutoCAD net api. But how can I link to the net dll and call the functions from a COM exe (VB6) file ? I found a sample which works for linkng non-AutoCAD net dll (i.e. register for com interlop) , but what I am looking for is a sample code which passes and returns parameters between COM exe and NET dll where NET dll retreives some AutoCAD values through the net api and return them to the calling COM routine. I am assumming that the NET dll must be loaded in AutoCAD first or is there a way to load it from the calling COM exe file ?

Thanks in advance for your reply.

Andrew,
0 Likes
1,303 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable
You can build a COM server that is loaded into AutoCAD
using the AcadApplication.GetInterfaceObject() method.

The only difference between a COM server that runs in
AuotCAD and any other COM server, is that you must
derive your COM server class from this class:

System.EnterpriseServices.ServicedComponent

Doing that ensures that your server methods run in
the correct execution context, and can access the
ObjectARX API.

--
http://www.caddzone.com

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

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6386824@discussion.autodesk.com...
I am sure this has been discussed before, but I can't find any solid answer
after doing some search.
I found many samples for creating a net dll which uses the new AutoCAD net api.
But how can I link to the net dll and call the functions from a COM exe (VB6)
file ? I found a sample which works for linkng non-AutoCAD net dll (i.e.
register for com interlop) , but what I am looking for is a sample code which
passes and returns parameters between COM exe and NET dll where NET dll
retreives some AutoCAD values through the net api and return them to the calling
COM routine. I am assumming that the NET dll must be loaded in AutoCAD first or
is there a way to load it from the calling COM exe file ?

Thanks in advance for your reply.

Andrew,
0 Likes
Message 3 of 8

dnl999
Advocate
Advocate
Thank you very much and hopefully after following your instructions I will see the light at the end of tunnel. 🙂
0 Likes
Message 4 of 8

dnl999
Advocate
Advocate

Tony,

 

After some hard work I was able to do what you described on Windows XP with Civil 3D 2011 (32-bit).

But, it doesn't seem to work on Windows 7 with Civil 3D 2011 64-bit version.  It keeps giving me the message "Problem in loading application"  at the line getinterfaceObject.  I created the dll and tlb file in VS 2008 on both platforms but still the same problem.

 

Any idea ?...  Thank you so much for your help.

 

Andrew,

0 Likes
Message 5 of 8

Anonymous
Not applicable

How did you deploy your server?  And, did you register it ?

 

If you're using a 32 bit AutoCAD, then you need to use the 32 bit version

of your DLL, and you have to make sure it's registered as a 32 bit server.

0 Likes
Message 6 of 8

dnl999
Advocate
Advocate

32-bit civil 3D 2011 on Windows XP worked fine probably because vs 2008 automatically registered the dll/tbl.  It is the 64-bit civil 3D 2011 on Windows 7 (64-bit) I am having problem with.  Since the client is a vb6 exe application, do I have to compile & register the dll/tlb using regsvr32  or regasm on Windows 7 ?

Thanks again

0 Likes
Message 7 of 8

Anonymous
Not applicable

Yes, you can't rely on VS to register your active servers.

 

 

0 Likes
Message 8 of 8

dnl999
Advocate
Advocate

Ok, thanks for the info and I will try again.

You have been very helpful.

Thanks again.

 

Andrew,

0 Likes