Thursday, March 17, 2011

Alignment–Finding Direction at Point

The code snippet below shows how to find the tangent direction on an alignment at a given statin/offset value. This may be useful in performing report calculations. In looking through the API documentation it may not be easily noticed since it’s hiding in the PointLocationEx method of an alignment.

        Dim settingsStation As AeccLandLib.AeccSettingsStation
settingsStation = ReportApplication.AeccXDatabase.Settings.AlignmentSettings.AmbientSettings.StationSettings
Dim tolerance As Double
tolerance = Math.Pow(10, -settingsStation.Precision.Value)

Dim curStation As Double
For curStation = stationStart To stationEnd Step staIncment
Dim curNorthing As Double
Dim curEasting As Double
Dim curTangent As Double

If oAlignment.PointLocationEx(curStation, 0.0, tolerance, curEasting, curNorthing, curTangent) _
= AeccLandLib.AeccAlignmentReturnValue.aeccOK Then
Dim stationString As String
stationString = oAlignment.GetStationStringWithEquations(curStation)

Dim alignData As New DirectionData
alignData.station = stationString
alignData.northing = FormatCoordSettings(curNorthing)
alignData.easting = FormatCoordSettings(curEasting)
alignData.tangentialDirection = FormatDirSettings(Math.PI / 2 - curTangent)

End If
Catch ex As Exception
Diagnostics.Debug.Assert(False, ex.Message)
End Try

The code snippet is from the Civil 3D Reports Source code that ships with the product.

No comments:


Blog Widget by LinkWithin