Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Initialize Civil 3D 2010 Object Model Error

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
967 Views, 6 Replies

Initialize Civil 3D 2010 Object Model Error

Hi,

I'm trying to run some VBA routines made for C3D 2009 in C3D 2010, but I'm
allways getting the error message:

Error: Unable to initialize Civil 3D Object Model

I'm sure it's a very basic question but can anyone help me we this?

Tks
Luis
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: Anonymous

Hello Luís,
I haven't used VBA in Civil3D (doing all .NET) but does your routine reference
a specific Civil3D version that might stop if from running?

> Hi,
>
> I'm trying to run some VBA routines made for C3D 2009 in C3D 2010, but
> I'm allways getting the error message:
>
> Error: Unable to initialize Civil 3D Object Model
>
> I'm sure it's a very basic question but can anyone help me we this?
>
> Tks
> Luis
Message 3 of 7
Anonymous
in reply to: Anonymous

Hi,
No it doesn't, it catches de version number before start it.

Tks
Luis

"Michael Robertson" wrote in message
news:6354148@discussion.autodesk.com...
Hello Luís,
I haven't used VBA in Civil3D (doing all .NET) but does your routine
reference
a specific Civil3D version that might stop if from running?

> Hi,
>
> I'm trying to run some VBA routines made for C3D 2009 in C3D 2010, but
> I'm allways getting the error message:
>
> Error: Unable to initialize Civil 3D Object Model
>
> I'm sure it's a very basic question but can anyone help me we this?
>
> Tks
> Luis
Message 4 of 7
Anonymous
in reply to: Anonymous

Hi Luis,

YOu need to:

Changes the references under [Tools][References] to suit R2010

You need to change the number 17.2 (for R2009) to 18 (for R2010) in the
GetCivilObjects code.

Lastly, save under a new name so you don't lose your R2009 functionality..

If that doesn't work, step through the code till you find the line
creating the error and post the line.


Regards,


Laurie Comerford

Luís Laíns wrote:
> Hi,
>
> I'm trying to run some VBA routines made for C3D 2009 in C3D 2010, but I'm
> allways getting the error message:
>
> Error: Unable to initialize Civil 3D Object Model
>
> I'm sure it's a very basic question but can anyone help me we this?
>
> Tks
> Luis
>
Message 5 of 7
Anonymous
in reply to: Anonymous

Hi Laurie
Thanks for the reply. Unfortunely still doesn't work. It looks like the Set
g_oCivilApp = ... that itsn't workink but I can't understand the reason.

Here is the code:

Option Explicit
Public g_oCivilApp As AeccApplication
Public g_oAeccDoc As AeccDocument
Public g_oAeccDb As AeccDatabase
'
' Start Civil 3D, create document and database objects.
'
Public Function InitCivil3D() As Boolean
Dim oApp As AcadApplication
Set oApp = ThisDrawing.Application
Const sAppName = "AeccXUiLand.AeccApplication.7.0"
Set g_oCivilApp = oApp.GetInterfaceObject(sAppName)
If g_oCivilApp Is Nothing Then
MsgBox "Error creating " & sAppName & ", exit."
InitCivil3D = False
Exit Function
End If
Set g_oAeccDoc = g_oCivilApp.ActiveDocument
Set g_oAeccDb = g_oAeccDoc.Database

InitCivil3D = True
End Function

Sub AlignHorizontalGeometry_RunReport()
On Error Resume Next

Dim rptDlg As ReportForm_HorizontalGeometry

' initialize C3D
If InitCivil3D = False Then
Call MsgBox("Error: Unable to initialize Civil 3D Object Model",
vbOKOnly, "Civil 3D Reports")
Exit Sub
End If

On Error Resume Next
Err.Clear
' Create report dialog and display it
Set rptDlg = New ReportForm_HorizontalGeometry
If Err.Number <> 0 Then
Exit Sub
End If
rptDlg.Show

Set rptDlg = Nothing
End Sub


Thanks
Luís

"Laurie" wrote in message
news:6354983@discussion.autodesk.com...
Hi Luis,

YOu need to:

Changes the references under [Tools][References] to suit R2010

You need to change the number 17.2 (for R2009) to 18 (for R2010) in the
GetCivilObjects code.

Lastly, save under a new name so you don't lose your R2009 functionality..

If that doesn't work, step through the code till you find the line
creating the error and post the line.


Regards,


Laurie Comerford

Luís Laíns wrote:
> Hi,
>
> I'm trying to run some VBA routines made for C3D 2009 in C3D 2010, but I'm
> allways getting the error message:
>
> Error: Unable to initialize Civil 3D Object Model
>
> I'm sure it's a very basic question but can anyone help me we this?
>
> Tks
> Luis
>
Message 6 of 7
Anonymous
in reply to: Anonymous

Hi Luis,

Your InitCivil3D code works in my R2010 environment and it is very
similar to the code I use.

Have you checked the references in [Tools][References]

You should be seeing:
Autodesk Civil engineering 7.0 Land Object Library
Autodesk Civil engineering 7.0 UILand Object Library

Also try the [Debug][Compile] command from inside the VBAIDE.


Regards,


Laurie Comerford

Luís Laíns wrote:
> Hi Laurie
> Thanks for the reply. Unfortunely still doesn't work. It looks like the Set
> g_oCivilApp = ... that itsn't workink but I can't understand the reason.
>
> Here is the code:
>
> Option Explicit
> Public g_oCivilApp As AeccApplication
> Public g_oAeccDoc As AeccDocument
> Public g_oAeccDb As AeccDatabase
> '
> ' Start Civil 3D, create document and database objects.
> '
> Public Function InitCivil3D() As Boolean
> Dim oApp As AcadApplication
> Set oApp = ThisDrawing.Application
> Const sAppName = "AeccXUiLand.AeccApplication.7.0"
> Set g_oCivilApp = oApp.GetInterfaceObject(sAppName)
> If g_oCivilApp Is Nothing Then
> MsgBox "Error creating " & sAppName & ", exit."
> InitCivil3D = False
> Exit Function
> End If
> Set g_oAeccDoc = g_oCivilApp.ActiveDocument
> Set g_oAeccDb = g_oAeccDoc.Database
>
> InitCivil3D = True
> End Function
>
>
> Thanks
> Luís
>
Message 7 of 7
Anonymous
in reply to: Anonymous

Hi Laurie,

Once again ... You're right 🙂
The [Debug] [Compile] did it

Thanks a lot
Luís


"Laurie" wrote in message
news:6355333@discussion.autodesk.com...
Hi Luis,

Your InitCivil3D code works in my R2010 environment and it is very
similar to the code I use.

Have you checked the references in [Tools][References]

You should be seeing:
Autodesk Civil engineering 7.0 Land Object Library
Autodesk Civil engineering 7.0 UILand Object Library

Also try the [Debug][Compile] command from inside the VBAIDE.


Regards,


Laurie Comerford

Luís Laíns wrote:
> Hi Laurie
> Thanks for the reply. Unfortunely still doesn't work. It looks like the
> Set
> g_oCivilApp = ... that itsn't workink but I can't understand the reason.
>
> Here is the code:
>
> Option Explicit
> Public g_oCivilApp As AeccApplication
> Public g_oAeccDoc As AeccDocument
> Public g_oAeccDb As AeccDatabase
> '
> ' Start Civil 3D, create document and database objects.
> '
> Public Function InitCivil3D() As Boolean
> Dim oApp As AcadApplication
> Set oApp = ThisDrawing.Application
> Const sAppName = "AeccXUiLand.AeccApplication.7.0"
> Set g_oCivilApp = oApp.GetInterfaceObject(sAppName)
> If g_oCivilApp Is Nothing Then
> MsgBox "Error creating " & sAppName & ", exit."
> InitCivil3D = False
> Exit Function
> End If
> Set g_oAeccDoc = g_oCivilApp.ActiveDocument
> Set g_oAeccDb = g_oAeccDoc.Database
>
> InitCivil3D = True
> End Function
>
>
> Thanks
> Luís
>

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report