.NET

Reply
Active Contributor
cokhitp
Posts: 31
Registered: ‎02-19-2011
Message 11 of 17 (463 Views)

Re: Vb.net & Autocad: Exception from HRESULT: 0x8007007E

11-28-2012 03:35 AM in reply to: cokhitp

Dear friends,

 

I have solved problem with this code:

--------------------------

        Const progID As String = "AutoCAD.Application.17"
        Dim acApp As AcadApplication = Nothing

        Try
            ' Intentar obtener la instancia activa
            acApp = DirectCast(Marshal.GetActiveObject(progID),  _
                             AcadApplication)

        Catch
            ' Si se produce un error
            Try
                ' Crear una instancia
                Dim acType As Type = Type.GetTypeFromProgID(progID)

                acApp = DirectCast(Activator.CreateInstance(acType, True),  _
                                AcadApplication)

            Catch
                ' Error ¿Esta Acad instalado?
            End Try

        End Try

        If acApp IsNot Nothing Then
            acApp.Documents.Open("E:\drawing1a.dwg")

            acApp.ActiveDocument.SendCommand("(command " & Chr(34) & "NETLOAD" & Chr(34) & " " & Chr(34) & "C:/Program Files/AutoCAD 2009/AcDx.dll" & Chr(34) & ") ")

        End If

----------------------------------

 

But now how i can change the value of attribute through my .exe application? Please help me? ^^ thank alots.

Valued Contributor
sszabo
Posts: 86
Registered: ‎09-05-2012
Message 12 of 17 (457 Views)

Re: Vb.net & Autocad: Exception from HRESULT: 0x8007007E

11-28-2012 05:03 AM in reply to: cokhitp

Great!

Active Contributor
cokhitp
Posts: 31
Registered: ‎02-19-2011
Message 13 of 17 (450 Views)

Re: Vb.net & Autocad: Exception from HRESULT: 0x8007007E

11-28-2012 06:30 AM in reply to: sszabo

sszabo,

 

But now how i can change the value of attribute through my .exe application? Please help me? ^^ thank alots.

Valued Contributor
sszabo
Posts: 86
Registered: ‎09-05-2012
Message 14 of 17 (437 Views)

Re: Vb.net & Autocad: Exception from HRESULT: 0x8007007E

11-28-2012 11:31 AM in reply to: cokhitp

1st method.

 

You can place your function in a new class project that has an interface exposing your function, compile the DLL yourdll.DLL and register it with COM.  Once ready you can create a new project for your exe, add your dll as a reference and you can get the COM interface with GetInterfaceObject() or with GetActiveObject() just as you did above.  Then you can either netload yourdll.DLL (not ac*.dll as you did above!) manually from ACAD or programatically via COM API using your interface object and then call your function.  That's the easiest. 

 

 

2nd method.

You can also create an in proc WCF server runnning inside autocad and talk to it from a WCF client running anywhere in the world as described in this video:

 

http://au.autodesk.com/?nd=event_class&jid=610987&session_id=7182

 

If you have problems let me know I might have some time this weekend to code up a simple example or find something on the web.

Active Contributor
cokhitp
Posts: 31
Registered: ‎02-19-2011
Message 15 of 17 (431 Views)

Re: Vb.net & Autocad: Exception from HRESULT: 0x8007007E

11-28-2012 04:12 PM in reply to: sszabo

sszabo,

 

Thank for your help!

 

I would like to use solution 1, but not clear understand. Cuold you help me to make a code example.

 

Please!!!!!

Valued Contributor
sszabo
Posts: 86
Registered: ‎09-05-2012
Message 16 of 17 (391 Views)

Re: Vb.net & Autocad: Exception from HRESULT: 0x8007007E

12-01-2012 05:27 AM in reply to: cokhitp
Active Contributor
cokhitp
Posts: 31
Registered: ‎02-19-2011
Message 17 of 17 (386 Views)

Re: Vb.net & Autocad: Exception from HRESULT: 0x8007007E

12-01-2012 07:19 AM in reply to: sszabo

Dear sszabo,

 

Now i know how to make it.

 

I will inform if my programe can work fullly.

 

Thank alot.

 

If one day you come to VietNam, please contact me! ^^

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.