GetObject autocad application issue in autocad 2025

GetObject autocad application issue in autocad 2025

murugamaha
Contributor Contributor
646 Views
2 Replies
Message 1 of 3

GetObject autocad application issue in autocad 2025

murugamaha
Contributor
Contributor

Hi Everybody, Good Day.

 

I am developing software using Visual Studio 2022 and autocad 2025. The software starts with .Net 8 COM and after autocad opens, it calls .Net 8 DLLs using sendcommand. The issue is, everytime i start the software, i have to create a new Application instead of using existing application. 

   Try
       Acadapp = GetObject(, "Autocad.Application")
   Catch ex As Exception

   End Try

   Try
       Acadapp = GetObject(, "AutoCAD.Application.25")
   Catch ex As Exception

   End Try
   Try
       Acadapp = GetObject(, "AutoCAD.Application.25.1")
   Catch ex1 As Exception

   End Try
   Try
       Acadapp = GetObject(, "AutoCAD.Application.25.0")
   Catch ex1 As Exception

   End Try
   Try
       Acadapp = GetObject(, "AutoCAD.Application.25.2")
   Catch ex1 As Exception

   End Try
   Acadapp = CreateObject("AutoCAD.Application")

 In the simple code, above, getobject never fetches autocad application. I tried to start without /nologo. Even then it does not work. Please help me.

0 Likes
Accepted solutions (1)
647 Views
2 Replies
Replies (2)
Message 2 of 3

ntclmain
Advocate
Advocate
Accepted solution

Have a look at this link:

"The GetActiveObject method is deprecated in .NET 8, specifically starting from .NET Core 3.0. The Marshal.GetActiveObject() API is a simple wrapper over the Running Object Table (ROT) and relies on folllwing Win32 APIs that can easily be called via P/Invoke."

https://adndevblog.typepad.com/autocad/2024/07/autocad-2025-marshalgetactiveobject-net-core.html

*

Here are some related content you may need:

https://github.com/ReneNyffenegger/.NET-API/blob/master/System/Runtime/InteropServices/Marshal/GetAc...

https://forums.autodesk.com/t5/net/getobject-is-not-working-in-2025-beta-version/td-p/12492974

0 Likes
Message 3 of 3

murugamaha
Contributor
Contributor

Thanks, I will Try. 😊

0 Likes