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

AutoCad 2007 & .NET

1 REPLY 1
Reply
Message 1 of 2
er.deepakpuri
823 Views, 1 Reply

AutoCad 2007 & .NET

 What is the best way to connect Autocad 2007 & .NET

I am trying by following method

 

Try
Cadapp = GetObject(, "Autocad.Application")
Catch ex As Exception
Cadapp = CreateObject("Autocad.Application")
End Try
If Cadapp.Documents.Count > 0 Then
For i = 0 To Cadapp.Documents.Count
Cadapp.Documents.Close() '(False)
Next

End If
Caddoc = Cadapp.Documents.Add
Caddoc = Cadapp.ActiveDocument
Cadapp.Visible = True

 

& getting error "Unable to cast COM object of type 'Autodesk.AutoCAD.Interop.AcadApplicationClass' to interface type 'Autodesk.AutoCAD.Interop.AcadApplication'"

 

Thanks 

 

Deepak

1 REPLY 1
Message 2 of 2
Balaji_Ram
in reply to: er.deepakpuri

Hi Deepak,

 

The best way would be to implement a plugin using .Net that can be netloaded in AutoCAD.

You would not need to use COM in that case.

 

About the error, you can try the following two points :

 

1) Verify if your project uses the interop assemblies from the correct ObjectARX version.

 

2) Try connecting to AutoCAD 2007 using a specific progid as in this code snippet.

 

const string progID = "AutoCAD.Application.17";
Type acType = Type.GetTypeFromProgID(progID);

 

Regards,

Balaji

 



Balaji
Developer Technical Services
Autodesk Developer Network

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