.NET

Reply
Active Contributor
pva75
Posts: 48
Registered: ‎07-22-2012
Message 1 of 2 (174 Views)

Call COM object from AutoCad 2011

174 Views, 1 Replies
07-22-2012 12:16 PM

I tried to call COM object created by C# from other C# module.

 

I did:

1. Create simple COM object by C#

2. Register it

3. Try to call this COM from other C# console application - it works fine

4. Create simple AutoCad module by C# with IExtensionApplication

5. Try to call this module from AutoCAD - it works

6. In Initialize() method I wrote:

 

Type myClassAdapterType = Type.GetTypeFromProgID("CoreAdapter.CoreAdapterClass");

 acDoc.Editor.WriteMessage("Type is OK: {0}", myClassAdapterType.FullName);

 object myClassAdapterInstance = Activator.CreateInstance(myClassAdapterType);

acDoc.Editor.WriteMessage("Created");

 

6. Open AutoCAD again

7. Load my module

8. I saw "Type is OK" (becase it was registered in registry)

 

But I can't create instance.

 

Can you help me?

ADN Support Specialist
Virupaksha.aithal
Posts: 93
Registered: ‎06-15-2011
Message 2 of 2 (132 Views)

Re: Call COM object from AutoCad 2011

07-26-2012 03:41 AM in reply to: pva75

Hi

 

It is tough to suggest from the information you have provide.

 

So, I will try to suggest few suggestions…

 

  1. First as test, implement a command in AutoCAD plug-in and try to instance in the command.
  2. Check whether your code is throwing any exception by using try and catch block
  3. Also try to add new line character “\n” in your “WriteMessage” like “ed.WriteMessage("Test" + "\n");

 



Virupaksha Aithal KM
Developer Technical Services
Autodesk Developer Network

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community