Hi,
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
<CommandMethod("TestAcadm")>
Public Sub cmdTestAcadm()
Dim AcadInterface As Autodesk.AutoCAD.Interop.AcadApplication
AcadInterface =clsAcadApp.AcadApplication
Dim SymBBInterface AsMcadSymbolBBMgr
SymBBInterface = AcadInterface.GetInterfaceObject("SymBBAuto.McadSymbolBBMgr.3")
MsgBox(SymBBInterface.StandardMgr.CurrentStandardName)
EndSub
<CommandMethod("TestAcadm2")>
Public Sub cmdTestAcadm2()
Dim AcadInterface As Autodesk.AutoCAD.Interop.AcadApplication
AcadInterface =clsAcadApp.AcadApplication
Dim SymBBInterface AsMcadSymbolBBMgr
Try
SymBBInterface = AcadInterface.GetInterfaceObject("SymBBAuto.McadSymbolBBMgr.3")
Catch ex AsException
MsgBox("Error with: <SymBBAuto.McadSymbolBBMgr.3>." & vbCr & ex.Message)
EndTry
EndSub
End Class
________________________________________________________________________
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?
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,
Hi,
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.
Hi Gilles,
I suppose you're french, me too
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...