Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have been using the following function in Civil3D 2020 to access the Civil Application Object and it works fine. It does not seem to work in Civil3D 2021?
I get an error on the line "Set g_oDocument = g_oCivilApp.ActiveDocument".
I guess it is something to do with being an AcadDocument and not an AeccDocument??? Any ideas?
Public oAcadApp As AcadApplication
Public g_oCivilApp As AcadApplication
Public g_oDocument As AeccDocument
Public g_oDatabase As AeccDatabase
Function GetGlobalCivilObjects() As Boolean
Set oAcadApp = ThisDrawing.Application
If InStr(oAcadApp.Name, "Autodesk Civil 3D 2021") > 0 Then
Set g_oCivilApp = oAcadApp.GetInterfaceObject("AeccXUiLand.AeccApplication.13.3")
Else
MsgBox oAcadApp.Name & " is not supported by this program", vbCritical
GetGlobalCivilObjects = False
Exit Function
End If
If g_oCivilApp Is Nothing Then
GetGlobalCivilObjects = False
MsgBox "Error getting Civil3D Interface object", vbCritical, "GetGlobabCivilOjbects Error Message"
Exit Function
End If
Set g_oDocument = g_oCivilApp.ActiveDocument
Set g_oDatabase = g_oDocument.Database
GetGlobalCivilObjects = True
End Function
Solved! Go to Solution.