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: 

StationOffsetElevationToXYZ

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
christopher
282 Views, 3 Replies

StationOffsetElevationToXYZ

I'm attempting to use StationOffsetElevationToXYZ in Civil 3D 2014. Unfortunately I am getting this error when attempting to use it. 

 

'StationOffsetElevationToXYZ' is ambiguous because multiple kinds of members with this name exist in class 'Autodesk.Civil.DatabaseServices.BaseBaseline'.

 

Looking in the help file it sure looks like it is duplicated: http://docs.autodesk.com/CIV3D/2014/ENU/API_Reference_Guide/html/f82270db-f165-35ca-aae6-1c28cb05351...

 

Is there a way to force it to use the non-obsolete call or obsolete call? 

 

I am using vb.NET for this project. 

3 REPLIES 3
Message 2 of 4
Partha.Sarkar
in reply to: christopher

Hi Chris,

 

We had already noticed this and it's very specific to VB.NET. If you use C# .NET it works fine.

 

Here is a workaround to address this  -

 

>>> 

  <CommandMethod("testBaseline")> _

  Public Sub TestCommand()

    Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database

    Dim civilDoc As CivilDocument = CivilApplication.ActiveDocument

 

    If (civilDoc.CorridorCollection.Count = 0) Then Exit Sub

 

    Using trans As Transaction = db.TransactionManager.StartOpenCloseTransaction

      Dim corr As Corridor = trans.GetObject(civilDoc.CorridorCollection.Item(0), OpenMode.ForRead)

      Dim bl As Baseline = corr.Baselines.Item(0)

 

      Dim soe As Point3d = New Point3d(bl.StartStation, 0, 0)

      Dim pointAtSOE As Point3d = bl.StationOffsetElevationToXYZ(soe)

    End Using

  End Sub

<<< 

 

And declare an VB.NET Module as below:

 

>>> 

Public Module Utility

  <System.Runtime.CompilerServices.Extension()> _

  Public Function StationOffsetElevationToXYZ(bl As Baseline, soe As Point3d) As Point3d

    Dim args As Object = {CType(soe, Object)}

    Dim argsModifiers As New System.Reflection.ParameterModifier(1)

    ' dont pass by reference, which is the new override for this method

    argsModifiers(0) = False

    Dim mods() As System.Reflection.ParameterModifier = {argsModifiers}

 

    ' Invoke the method late bound.

    Return bl.GetType().InvokeMember("StationOffsetElevationToXYZ", _

                                     System.Reflection.BindingFlags.InvokeMethod, _

                                     Nothing, bl, args, mods, Nothing, Nothing)

  End Function

End Module

<<< 

 

 

 

Cheers,

Partha Sarkar



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

Message 3 of 4
christopher
in reply to: Partha.Sarkar

Thanks, this works.

 

it would be helpful if this information was added to the help files page: http://docs.autodesk.com/CIV3D/2014/ENU/API_Reference_Guide/html/28344d90-000b-fe9c-57e4-c51644bf5d4...

Message 4 of 4
Partha.Sarkar
in reply to: christopher

Thanks !

Probably I will add this info in IM DevBlog till we get fixed in Civil 3D API.

 

Cheers,

Partha



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report