• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    AutoCAD Civil 3D Customization

    Reply
    Contributor
    Posts: 13
    Registered: ‎04-18-2008

    C3D 2012 SuperelevationCriticalStation.GetSlope VB.Net

    79 Views, 1 Replies
    07-31-2012 09:16 AM

    I'm having an issue in attempting to get the slope at a station 

     

    Executing this line of code

    nsLeftIn_End = mySuperStn.GetSlope(Autodesk.Civil.Land.SuperelevationCrossSegmentType.LeftInShoulderCrossSlope)

     

    in the function below throws an execption:

    Operation is not valid due to the current state of the object.

     

    I've stripped down the function to show where the error is happening. I verifiied that the execption is still thrown in this version of the function.

     

    I can't for the life of me figure out what is wrong with the state of the object that won't allow for getting the slope value.

     

    Any suggestions appreciated.

    Thanks.

     

     Function ModifySuper(ByRef myAlg As Alignment) As Boolean
            Dim nsLeftIn_End As Double
            Dim nsLeftOut_End As Double
            Dim nsRightIn_End As Double
            Dim nsRightOut_End As Double
    
            Dim mySuperCol As SuperelevationCriticalStationCollection
            Dim mySuperStn As SuperelevationCriticalStation
    
            ModifySuper = False
            Try
                If IsNothing(myAlg) Then
                    MsgBox("Cannot locate alignment in ModifySuper ", vbExclamation)
                    Exit Function
                End If
    
                mySuperCol = myAlg.SuperelevationCriticalStations
                For Each mySuperStn In mySuperCol
                    Select Case mySuperStn.StationType
                        Case Autodesk.Civil.Land.SuperelevationCriticalStationType.BeginAlignment
    
                        Case Autodesk.Civil.Land.SuperelevationCriticalStationType.EndAlignment
    
                        Case Autodesk.Civil.Land.SuperelevationCriticalStationType.BeginNormalCrown
    
                        Case Autodesk.Civil.Land.SuperelevationCriticalStationType.EndNormalCrown
    
                        Case Autodesk.Civil.Land.SuperelevationCriticalStationType.EndNormalShoulder
                            Try
                                nsLeftIn_End = mySuperStn.GetSlope(Autodesk.Civil.Land.SuperelevationCrossSegmentType.LeftInShoulderCrossSlope)
                                nsLeftOut_End = mySuperStn.GetSlope(Autodesk.Civil.Land.SuperelevationCrossSegmentType.LeftOutShoulderCrossSlope)
                                nsRightIn_End = mySuperStn.GetSlope(Autodesk.Civil.Land.SuperelevationCrossSegmentType.RightInShoulderCrossSlope)
                                nsRightOut_End = mySuperStn.GetSlope(Autodesk.Civil.Land.SuperelevationCrossSegmentType.RightOutShoulderCrossSlope)
    
                            Catch ex As Exception
                                MsgBox("Exception: " & ex.Message)
                            End Try
    
                        Case Autodesk.Civil.Land.SuperelevationCriticalStationType.LevelCrown
                    End Select
    
                Next
    
                ModifySuper = True
    
            Catch ex As Exception
                MsgBox("Execption: " & ex.Message)
            End Try
        End Function

     

    Please use plain text.
    ADN Support Specialist
    Posts: 206
    Registered: ‎06-09-2009

    Re: C3D 2012 SuperelevationCriticalStation.GetSlope VB.Net

    08-03-2012 03:50 AM in reply to: RodWing

    Hi RodWing,

     

    Did you check in the UI dialog if there is a valid value set for LeftInShoulderCrossSlope at that station?


    You can take a look at the following Blog post and check the screenshot I used there to understand which UI window I am referring here.

     

    http://adndevblog.typepad.com/infrastructure/2012/06/want-to-add-a-superelevationcriticalstation-usi...


    Thanks,



    Partha Sarkar
    Developer Technical Services
    Autodesk Developer Network

    Please use plain text.