Posts: 20
Registered: ‎09-29-2006
Message 1 of 3 (257 Views)

Interop 32/64 COM - Acad Mechanical

257 Views, 2 Replies
12-12-2012 11:38 PM



Here is my sample code with the context: .Net Framework 4 / AnyCpu / ObjectArx2012:


Imports Autodesk.AutoCAD.Runtime

Imports SymBBAuto

Imports clsAcadApp = Autodesk.AutoCAD.ApplicationServices.Application


Public ClassClass1


 Public Sub cmdTestAcadm()

      Dim AcadInterface As Autodesk.AutoCAD.Interop.AcadApplication

      AcadInterface =clsAcadApp.AcadApplication


  Dim SymBBInterface AsMcadSymbolBBMgr

     SymBBInterface = AcadInterface.GetInterfaceObject("SymBBAuto.McadSymbolBBMgr.3")





Public Sub cmdTestAcadm2()

   Dim AcadInterface As Autodesk.AutoCAD.Interop.AcadApplication

       AcadInterface =clsAcadApp.AcadApplication


   Dim SymBBInterface AsMcadSymbolBBMgr


             SymBBInterface = AcadInterface.GetInterfaceObject("SymBBAuto.McadSymbolBBMgr.3")

       Catch ex AsException

             MsgBox("Error with: <SymBBAuto.McadSymbolBBMgr.3>." & vbCr & ex.Message)




End Class



  • First of all, if I add a reference to …\ObjectARX 2012\inc-win32\Autodesk.AutoCAD.Interop.dll, so this will work fine for Acad / AcadM 2012 on XP 32bits, but not on Seven 64bits.


If I replace this reference with …\ObjectARX 2012\inc-x64\Autodesk.AutoCAD.Interop.dll, this will work fine for Acad / AcadM 2012 on Seven 64bits, but not on XP 32bits.


So, my first question, do I need to create 2 solutions in Visual Studio, the first one referencing the win32 Interop and the second one referencing the x64 Interop? Isn't it possible to have only one solution for either 32 or 64 bits OS?


  • As you can see in the second Sub, the "Try-Catch" is just there to "detect" if we are on just AutoCAD (error) or AutoCAD Mechanical (no error) :smileytongue:

Is there a better solution to detect if we are really in the Mechanical Release, or to detect if the COM (here SymBB) is loaded?


Thanks a lot for your answers,

*Expert Elite*
Posts: 2,115
Registered: ‎04-29-2006
Message 2 of 3 (252 Views)

Re : Interop 32/64 COM - Acad Mechanical

12-13-2012 12:06 AM in reply to: glanard



While referencing Autodesk.AutoCAD.Interop you'll have to build two different assembly.

The only way I know to avoid this is using late binding (or dynamic type if targeting the Framework 4) where the main inconvenient is the loose of intellisense and edition/complation errors which will throw at execution time.

You can create and debug your app using Autodesk.AutoCAD.Interop reference and when it's done, replace all COM types with Object (or dynamic) type and release the Interop reference.

Gilles Chanteau
Posts: 20
Registered: ‎09-29-2006
Message 3 of 3 (249 Views)

Re: Interop 32/64 COM - Acad Mechanical

12-13-2012 12:18 AM in reply to: glanard

Hi Gilles,


I suppose you're french, me too :smileyhappy:


Well, I had an idea and it seems to work^^


Referencing any of the win32 or x64 Interop, I change its property "Incorporer les types Interop" to False (and "Copie locale" to False) and my (same) DLL works fine either on XP32 or Seven 64!!


So, for me it's a good news, if anyone can confirm that there is no restriction doing this?


I know I will have to manage some things like ObjectID and ObjectID32, but this is just some "If... then...".




Edit: There is still the question: how to detect we are in "Mechanical", with the SymBB COM loaded...

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
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!