.NET

Reply
Contributor
rajpaul75
Posts: 14
Registered: ‎06-24-2009
Message 1 of 4 (299 Views)

Stand alone applications

299 Views, 3 Replies
06-26-2009 02:03 AM
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
*Bobby C. Jones
Message 2 of 4 (299 Views)

Re: Stand alone applications

06-30-2009 01:45 PM 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
*Expert Elite*
arcticad
Posts: 1,285
Registered: ‎06-21-2004
Message 3 of 4 (299 Views)

Re: Stand alone applications

06-30-2009 02:16 PM 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))
Contributor
rajpaul75
Posts: 14
Registered: ‎06-24-2009
Message 4 of 4 (299 Views)

Re: Stand alone applications

07-03-2009 01:18 AM in reply to: rajpaul75
Thank you bobby and arcticad . It works .

If i use 7 forms , DLL method is best or standalone ?
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!