oldguy Posted September 28, 2011 Posted September 28, 2011 I have a .NET program that extract information from autoCAD that was working fine on autoCAD 2008 but failed badly on 2011/2012. It failed on activeX can't create object or call rejected by callee I used obj=createObject("autodesk.Application") Anyone has some finished code that could safely create the object? I have search through the internet for many articles, they just don't help or incomplete. I need VB.net code instead of c#. Alex Quote
Jeff H Posted September 28, 2011 Posted September 28, 2011 I guess you trying something like this http://www.theswamp.org/index.php?topic=39578.0 '''' Const progIDstr As String = "AutoCAD.Application.18.1"'''---- 2011 '''' Const progIDstr As String = "AutoCAD.Application.18.0"'''---- 2010 Const progIDstr As String = "AutoCAD.Application.18.2" '''''' ---- 2012 Dim app As AcadApplication = Nothing Try Try app = Marshal.GetActiveObject(progIDstr) app.Visible = True Catch app = New AcadApplicationClass() app.Visible = True End Try Catch ex As Exception Return End Try Quote
oldguy Posted September 28, 2011 Author Posted September 28, 2011 Thanks! but I don't have class "Marshal" or "AcadApplicationClass" available. I did add Autodesk.AutoCAD.Interop & Autodesk.AutoCAD.Interop.Common to my project reference. Quote
Jeff H Posted September 28, 2011 Posted September 28, 2011 Thanks! but I don't have class "Marshal" or "AcadApplicationClass" available. If you have AutoCAD 2007 or at least .NET 2.0 installed than you do. In the Link posted previously look at code in 2nd Reply You should add Imports System.Runtime.InteropServices Marshal Class That part of the code that uses Marshal.GetActiveObject(progIDstr) is to get AutoCAD if it is already running. Quote
oldguy Posted September 28, 2011 Author Posted September 28, 2011 ah... I am using visual Studio 2005 with Windows XP. that is why I don't have any of those, I guess I need to upgrade.... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.