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

Stand alone applications

3 REPLIES 3
Reply
Message 1 of 4
rajpaul75
617 Views, 3 Replies

Stand alone applications

I have a standalone application in .net .Give me some ideas how to connect the autocad as my standalone application needs "select a point" and i am looking to select the current cad layout not a new instance.

Thanks for your help

Paul
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: rajpaul75

COM Interop. Check out
System.Runtime.InteropServices.Marshal.GetActiveObject, although I haven't a
clue how to find a specific instance if multiple instances of acad are
running.
--
Bobby C. Jones
http://bobbycjones.spaces.live.com

wrote in message news:6209004@discussion.autodesk.com...
I have a standalone application in .net .Give me some ideas how to connect
the autocad as my standalone application needs "select a point" and i am
looking to select the current cad layout not a new instance.

Thanks for your help

Paul
Message 3 of 4
arcticad
in reply to: rajpaul75

You can't choose which instance of Autocad you want to connect to.
COM will connect to the first instance available.

The sample below is for 2009

{code}
Public acadApp As Autodesk.AutoCAD.Interop.AcadApplication

Public Sub getOdbx(ByRef acadApp As Autodesk.AutoCAD.Interop.AcadApplication, ByRef acadDBX As Object, ByVal FileName As String)

Try
acadDBX = acadApp.GetInterfaceObject("ObjectDBX.AxDbDocument.17")
Catch ex As Exception
Try
If Not acadApp Is Nothing Then
Try
acadApp = GetObject(, "AutoCAD.Application.17.2")
Catch ex3 As Exception
acadApp = Nothing
End Try
End If
acadDBX = acadApp.GetInterfaceObject("ObjectDBX.AxDbDocument.17")
Catch ex2 As Exception
MessageBox.Show("Error Connecting to AutoCAD", "Autocad Message", MessageBoxButtons.OK, MessageBoxIcon.Stop)
End Try
End Try
End Sub
{code}
---------------------------



(defun botsbuildbots() (botsbuildbots))
Message 4 of 4
rajpaul75
in reply to: rajpaul75

Thank you bobby and arcticad . It works .

If i use 7 forms , DLL method is best or standalone ?

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