Jump to content

Help opening autocad in VB 2008


FunkyFresh

Recommended Posts

We are having much trouble opening a AutoCad 2010 file in VB 2008. This is the error we get:

Creating an instance of the COM component with CLSID {6D7AE628-FF41-4CD3-91DD-34825BB1A251} from the IClassFactory failed due to the following error: 80010001.

 

For this code (code that was highlight *):

Private Sub btnStartACAD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStartACAD.Click, btnStartACAD.Click

'Opens AutoCAD and makes it visible

* AcadApp = New Autodesk.AutoCAD.Interop.AcadApplication

AcadApp.Visible = True

End Sub

Link to comment
Share on other sites

Would this help?

 

Dim process As System.Diagnostics.Process

 

Process = System.Diagnostics.Process.Start(programPath)

Process.WaitForExit()

Link to comment
Share on other sites

this does work but I cant associate it with AutoCad as I would like to make it as a document to be able to draw to it, save it, etc.

 

unless I can tie this to be an autocad app somehow...

Link to comment
Share on other sites

Not sure I totally understand but you may be using an older or newer library reference than the one needed; try some different ones out and or load up on a bunch.......just my guess.

Link to comment
Share on other sites

sorry, what i mean is I need to associate the process as an Acad Application. So then I can associate the running instance (or application) as an Acad Document that I could draw to and eventually save as.

 

I came up with this code as well

AcadApp = GetObject(, "AutoCad.Application")

AcadApp.Visible = True ' makes it visible as it runs in the back by default

 

but the problem with this code is its basically a lottery, sometimes it works and sometimes it doesnt

Link to comment
Share on other sites

  • 1 year later...

public AcadApplication GetAcadApplication()

{

AcadApplication acApp = null;

const string progID = "AutoCAD.Application";

try

{

acApp = (AcadApplication)Marshal.GetActiveObject(progID);

}

catch

{

try

{

acApp = new AcadApplication();

}

catch

{

System.Threading.Thread.Sleep(500);

acApp = (AcadApplication)Marshal.GetActiveObject(progID);

}

}

if (acApp != null)

{

acApp.Visible = true;

}

return acApp;

}

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...