Trouble with C3d 2012 COM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello All,
I am having trouble getting the COM application objects, after trying a number of different methods that I managed to find in the (scant) literature and elsewhere. I am using VB2010, w7 64 bit and C3D 64 bit.
The code in question reads...
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Interop
Imports Autodesk.AECC.Interop.UiLand
Imports Autodesk.Civil.ApplicationServices
Module Civil3DObjects
FriendConst ACAD_VERSION AsString = "AutoCAD.Application"
FriendConst CIVIL3D_VERSION AsString = "AeccXUiLand.AeccApplication.9.0"
'net
Friend netDOC AsCivilDocument
Friend netEDITOR AsEditor
'com
Friend comAcadApp As Autodesk.AutoCAD.Interop.IAcadApplication
Friend comAeccApp As Autodesk.AECC.Interop.UiLand.IAeccApplication
Friend comAeccDoc AsIAeccDocument
Friend comAeccDB As Autodesk.AECC.Interop.Land.IAeccDatabase
FriendFunction GetCOMobjects() AsBoolean
'returns true if successfull
GetCOMobjects = False
'comAcadApp = TryCast(Application.AcadApplication, AcadApplication)
'comAeccApp = TryCast(comAcadApp.GetInterfaceObject(CIVIL3D_VERSION), AeccApplication)
'If comAeccApp Is Nothing Then
' Throw New COMInstanceException("Unable to retrieve interface for Civil Application.", CIVIL3D_VERSION)
'End If
Try
If IsNothing(comAcadApp) Then
comAcadApp = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication
EndIf
Catch ex As System.Exception
MsgBox("Cannot load AutoCAD Application")
Return False
EndTry
IfNot comAcadApp IsNothing Then
Try
comAeccApp = comAcadApp.GetInterfaceObject(CIVIL3D_VERSION)
comAeccDoc = comAeccApp.ActiveDocument
comAeccDB = comAeccApp.ActiveDocument.Database
Catch ex As System.Exception
MsgBox("Cannot load Civil3D Application")
Return False
EndTry
EndIf
Return True
EndFunction
Everything goes pear shaped at...
comAeccApp = comAcadApp.GetInterfaceObject(CIVIL3D_VERSION)
where CIVIL3D_VERSION = "AeccXUiLand.AeccApplication.9.0"
The project references are shown in the attached image.
This has stumped me for a couple of days now and I am sure that I will feel like a goose for missing something simple. Please help.
Regards,
Anthony
