Export/Save Vertical Alignment Information

Hello everyone,

I'm new to programing in .mvba, I'm wanting to automate the exportation of the Review Vertical Alignment window for projects. So far I haven't been able to do much except for bringing up the window using a Keyin

Here is my Code

Sub Geometrics()
' Start a command
CadInputQueue.SendCommand "inroadsgeometry reviewvertical"
End Sub

Ultimately I want to obtain the station, elevation, and tangent information and put them in an excel spreadsheet for further analysis. What I'm having trouble is being able to select save as, or print.

Would any of yall have any suggestions for interacting with the active window, selecting save as, and specifying the location? 

Parents
  • Hi Saul,

    this is MicroStation programming forum, not InRoads.

    I recommend to move your post to Civil programming forum. To move existing post, use More > Move tool under your original post.

    With regards,

     Jan

  • Saul,

    I get my profile info using vba.  The key is to get the files that have all the InRoads (SCad) declarations in them. 

    The 3 function declaration modules I have came from these text files, Copyright date 2001 from Bentley

    SCadSDK.TXT

    Option Explicit
    
    ' -----------------------------------------------------------------------------
    '
    ' Copyright (2001) Bentley Systems, Inc., All rights reserved.
    '
    ' MicroStation, InRoads, InRail and MDL are registered trademarks and "MicroCSL"
    ' is a trademark of Bentley Systems, Inc.
    '
    '
    ' Limited permission is hereby granted to reproduce and modify this
    ' copyrighted material provided that the resulting code is used only
    ' in conjunction with Bentley Systems products under the terms of the
    ' license agreement provided therein, and that this notice is retained
    ' in its entirety in any such reproduction or modification.
    '
    ' -----------------------------------------------------------------------------
    '
    ' SCadSDK.TXT -- InRoads SDK Declarations for Visual Basic
    '
    ' This file contains only the Const, Type,
    ' and Declare statements for InRoads SDK.
    '
    ' -----------------------------------------------------------------------------
    
    '**************************
    '   CONSTANT Declarations
    '**************************
    
    Public Const SDK_SUCCESS = 0
    Public Const SDK_NOLICENSE = -1
    Public Const SDK_TRUE = 1
    Public Const SDK_FALSE = 0
    Public Const DTM_M_NOINTF = 1120
    '**************************
    '   TYPE Declarations
    '**************************
    
    ' DPoint3d holds a 3 diminsional double point
    Type DPoint3d
        X As Double
        y As Double
        z As Double
    End Type
    
    ' DPoint2d holds a 2 diminsional double point
    Type DPoint2d
        X As Double
        y As Double
    End Type
    
    '**************************
    '   FUNCTION Declarations
    '**************************
    
    'Public Declare Function scadSDK_initialize Lib "c:\program files\bentley\InRoads Group V8.11\bin\SCadSDKAT.dll" () As Long
    'Public Declare Function scadSDK_freeLicense Lib "c:\program files\bentley\InRoads Group V8.11\bin\SCadSDKAT.dll" () As Long
    Public Declare Function scadSDK_initialize Lib "SCadSDKAT" () As Long
    Public Declare Function scadSDK_freeLicense Lib "SCadSDKAT" () As Long
    

    SCadDTM.TXT

    ' -----------------------------------------------------------------------------
    '
    ' Copyright (2001) Bentley Systems, Inc., All rights reserved.
    '
    ' MicroStation, InRoads, InRail and MDL are registered trademarks and "MicroCSL"
    ' is a trademark of Bentley Systems, Inc.
    '
    '
    ' Limited permission is hereby granted to reproduce and modify this
    ' copyrighted material provided that the resulting code is used only
    ' in conjunction with Bentley Systems products under the terms of the
    ' license agreement provided therein, and that this notice is retained
    ' in its entirety in any such reproduction or modification.
    '
    ' -----------------------------------------------------------------------------
    '
    ' SCadDTM.TXT -- InRoads Surface SDK Declarations for Visual Basic
    '
    ' This file contains only the Const, Type,
    ' and Public Declare statements for  InRoads Surface SDK.
    '
    ' -----------------------------------------------------------------------------
    
    '**************************
    '   CONSTANT Declarations
    '**************************
    
    ' String Sizes
    Public Const CIV_C_NAMSIZ = 32
    Public Const CIV_C_DESSIZ = 64
    Public Const CIV_MAX_PATH = 256
    
    ' Profile Offset Indexes
    Public Const DTM_C_PRFOFF1 = 0
    Public Const DTM_C_PRFOFF2 = 1
    Public Const DTM_C_PRFOFF3 = 2
    Public Const DTM_C_PRFOFF4 = 3
    Public Const DTM_C_PRFOFF5 = 4
    Public Const DTM_C_PRFOFF6 = 5
    Public Const DTM_C_PRFOFF7 = 6
    Public Const DTM_C_PRFOFF8 = 7
    Public Const DTM_C_PRFOFF9 = 8
    Public Const DTM_C_PRFOFF10 = 9
    Public Const DTM_C_PRFOFF11 = 10
    Public Const DTM_C_PRFOFF12 = 11
    Public Const DTM_C_PRFOFF13 = 12
    Public Const DTM_C_PRFOFF14 = 13
    Public Const DTM_C_PRFOFF15 = 14
    Public Const DTM_C_PRFOFF16 = 15
    
    ' Number of Profile Offsets
    Public Const DTM_C_NUMPRFOFF = 16
    
    ' Feature types
    Public Const DTM_C_DTMREGFTR = 17      ' random point feature type
    Public Const DTM_C_DTMBRKFTR = 18      ' breakline feature type
    Public Const DTM_C_DTMINTFTR = 19      ' interior boundary feature
    Public Const DTM_C_DTMEXTFTR = 20      ' exterior boundary feature
    Public Const DTM_C_DTMCTRFTR = 21      ' contour feature
    
    
    ' Triangle Set Index Options
    Public Const FIRST_TRIANGLE = 0         ' set index to first triangle
    Public Const LAST_TRIANGLE = 1          ' set index to last triangle
    Public Const MIDDLE_TRIANGLE = 2       ' set index to given triangle
    
    
    '**************************
    '   FUNCTION Declarations
    '**************************
    
    ' General Surface Functions
    Public Declare Function scadSDK_dtmGetRange Lib "SCadSDKAT" (ByVal srf As Long, minP As Point3d, maxP As Point3d) As Long
    Public Declare Function scadSDK_dtmCountSurfaces Lib "SCadSDKAT" (numSrf As Long) As Long
    Public Declare Function scadSDK_dtmGetSurfaces Lib "SCadSDKAT" (srfs As Long, numSrfsP As Long) As Long
    Public Declare Function scadSDK_dtmGetActiveSurface Lib "SCadSDKAT" (srf As Long, ByVal srfName As Long, ByVal srfDesc As Long) As Long
    Public Declare Function scadSDK_dtmSetActiveSurface Lib "SCadSDKAT" (ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmSurfaceFindByName Lib "SCadSDKAT" (srf As Long, ByVal srfName As Long) As Long
    Public Declare Function scadSDK_dtmSurfaceInfoGet Lib "SCadSDKAT" (ByVal Name As Long, ByVal desc As Long, ByVal file As Long, ByVal mat As Long, ByVal pref As Long, ByVal secsymb As Long, ByVal prfSymb As Long, maxTriLength As Double, useFtrsOnlyXSect As Long, useFtrsOnlyPrf As Long, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmGetSurfaceOffset Lib "SCadSDKAT" (dis As Double, ByVal sym As Long, ByVal offsetIndex As Long, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmCountSurfacePoints Lib "SCadSDKAT" (npnt As Long, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmCountSurfacePointsWithRange Lib "SCadSDKAT" (npnt As Long, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmGetSurfaceTotals Lib "SCadSDKAT" (numActTriangle As Long, numDelTriangle As Long, numActRandom As Long, numDelRandom As Long, numActBreak As Long, numDelBreak As Long, numActInferred As Long, numDelInferred As Long, numActContour As Long, numDelContour As Long, numActInterior As Long, numDelInterior As Long, numActExterior As Long, numDelExterior As Long, numActRandomFtr As Long, numDelRandomFtr As Long, numActBreakFtr As Long, numDelBreakFtr As Long, numActContourFtr As Long, numDelContourFtr As Long, numActInteriorFtr As Long, numDelInteriorFtr As Long, numActExteriorFtr As Long, numDelExteriorFtr As Long, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmCountBoundaries Lib "SCadSDKAT" (numInt As Long, numExt As Long, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmCountSurfaceFeatures Lib "SCadSDKAT" (nftr As Long, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmGetSurfaceElevationAtXY Lib "SCadSDKAT" (pnt As Point3d, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmSurfaceInfoSet Lib "SCadSDKAT" (ByVal Name As Long, ByVal desc As Long, ByVal file As Long, ByVal mat As Long, ByVal pref As Long, ByVal secsymb As Long, ByVal prfSymb As Long, maxTriLength As Double, useFtrsOnlyXSect As Long, useFtrsOnlyPrf As Long, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmSetSurfaceOffset Lib "SCadSDKAT" (ByVal dis As Double, ByVal sym As Long, ByVal offsetIndex As Long, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmIntersectLineAndSurface Lib "SCadSDKAT" (pntP As Point3d, ByVal srf As Long, ByVal srfElevAdj As Double, linP As Point3d) As Long
    Public Declare Function scadSDK_dtmSurfaceTriangulate Lib "SCadSDKAT" (ByVal srf As Long, ByVal bExtendedDataChecks As Long, maxTriangleLengthP As Double) As Long
    Public Declare Function scadSDK_dtmContoursGetLineInfo Lib "SCadSDKAT" (ByVal srf As Long, interval As Double, minorsPerMajor As Long, smoothing As Long, totalLines As Long, maxPoints As Long) As Long
    Public Declare Function scadSDK_dtmContoursGetLines Lib "SCadSDKAT" (ByVal srf As Long, interval As Double, minorsPerMajor As Long, smoothing As Long, maxPoints As Long, dpts As Point3d) As Long
    Public Declare Function scadSDK_dtmContoursIterate Lib "SCadSDKAT" (ByVal srf As Long, interval As Double, minorsPerMajor As Long, smoothing As Long, ByVal pCallBack As Long) As Long
    Public Declare Function scadSDK_dtmDrapeLineStringGetCount Lib "SCadSDKAT" (ByVal srf As Long, ByVal inPtNum As Long, inPoints As Point3d, outPtNum As Long) As Long
    Public Declare Function scadSDK_dtmDrapeLineString Lib "SCadSDKAT" (ByVal srf As Long, ByVal inPtNum As Long, inPoints As Point3d, outPtNum As Long, outPoints As Point3d) As Long
    Public Declare Function scadSDK_dtmSurfaceThin Lib "SCadSDKAT" (numBeforeThin As Long, numAfterThin As Long, ByVal srfOut As Long, ByVal srfIn As Long, ByVal heightTol As Double, ByVal minDistanceTol As Double, ByVal maxDistanceTol As Double, ByVal copyInfBreaklines As Long) As Long
    Public Declare Function scadSDK_dtmSurfacePerimeterGetCount Lib "SCadSDKAT" (ByVal srf As Long, numPoints As Long) As Long
    Public Declare Function scadSDK_dtmSurfacePerimeter Lib "SCadSDKAT" (ByVal srf As Long, numPoints As Long, vrtArray As Point3d) As Long
    
    ' Point Functions
    Public Declare Function scadSDK_dtmPointsInitialize Lib "SCadSDKAT" (ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmPointsUninitialize Lib "SCadSDKAT" () As Long
    Public Declare Function scadSDK_dtmPointsGetIndex Lib "SCadSDKAT" (ByVal pnt As Long, index As Long) As Long
    Public Declare Function scadSDK_dtmPointsGetPoint Lib "SCadSDKAT" (ByVal index As Long, pnt As Long) As Long
    Public Declare Function scadSDK_dtmPointsGetInfo Lib "SCadSDKAT" (ByVal pnt As Long, X As Double, y As Double, z As Double) As Long
    
    ' Triangle Functions
    Public Declare Function scadSDK_dtmFindTriangle Lib "SCadSDKAT" (ByVal srf As Long, pnt As Point3d, triangle As Point3d) As Long
    Public Declare Function scadSDK_dtmTrianglesFind Lib "SCadSDKAT" (ByVal srf As Long, pnt As Point3d, triangle As Long) As Long
    Public Declare Function scadSDK_dtmTrianglesGetArea Lib "SCadSDKAT" (ByVal triangle As Long, trueArea As Double, planarArea As Double) As Long
    Public Declare Function scadSDK_dtmTrianglesGetAspect Lib "SCadSDKAT" (ByVal triangle As Long, aspect As Double) As Long
    Public Declare Function scadSDK_dtmTrianglesGetCoordinates Lib "SCadSDKAT" (ByVal triangle As Long, coords As Point3d) As Long
    Public Declare Function scadSDK_dtmTrianglesGetFirst Lib "SCadSDKAT" (triangle As Long) As Long
    Public Declare Function scadSDK_dtmTrianglesGetLast Lib "SCadSDKAT" (triangle As Long) As Long
    Public Declare Function scadSDK_dtmTrianglesGetNeighbors Lib "SCadSDKAT" (ByVal triangle As Long, triangle1 As Long, triangle2 As Long, triangle3 As Long) As Long
    Public Declare Function scadSDK_dtmTrianglesGetNext Lib "SCadSDKAT" (triangle As Long) As Long
    Public Declare Function scadSDK_dtmTrianglesGetPoints Lib "SCadSDKAT" (ByVal triangle As Long, p1 As Long, p2 As Long, p3 As Long) As Long
    Public Declare Function scadSDK_dtmTrianglesGetPrevious Lib "SCadSDKAT" (triangle As Long) As Long
    Public Declare Function scadSDK_dtmTrianglesGetSlope Lib "SCadSDKAT" (ByVal triangle As Long, slope As Double) As Long
    Public Declare Function scadSDK_dtmTrianglesInitialize Lib "SCadSDKAT" (ByVal srf As Long, triangle As Long) As Long
    Public Declare Function scadSDK_dtmTrianglesSetIndex Lib "SCadSDKAT" (ByVal location As Long, triangle As Long) As Long
    
    ' Surface Creation Functions
    Public Declare Function scadSDK_dtmSurfaceCreate Lib "SCadSDKAT" (srf As Long, ByVal Name As Long, ByVal desc As Long, ByVal file As Long, ByVal mat As Long, ByVal maxTriLength As Double, ByVal scl As Double) As Long
    Public Declare Function scadSDK_dtmSurfaceDelete Lib "SCadSDKAT" (ByVal srf As Long, ByVal emptyOnly As Long) As Long
    Public Declare Function scadSDK_dtmSurfaceDeleteByName Lib "SCadSDKAT" (ByVal srfName As Long, ByVal emptyOnly As Long) As Long
    
    ' Surface IO Functions
    Public Declare Function scadSDK_dtmSurfaceLoad Lib "SCadSDKAT" (srf As Long, fileWasTTN As Long, ByVal FileName As Long) As Long
    Public Declare Function scadSDK_dtmSurfaceSave Lib "SCadSDKAT" (ByVal srf As Long, ByVal FileName As Long) As Long
    Public Declare Function scadSDK_dtmSurfaceToLandXML Lib "SCadSDKAT" (ByVal dtmFileName As Long, ByVal landXMLFileName As Long) As Long
    Public Declare Function scadSDK_dtmSurfaceCopy Lib "SCadSDKAT" (ByVal srfOrgP As Long, srvNewPP As Long, ByVal Name As Long, ByVal desc As Long, ByVal style As Long, ByVal nOverwriteExisting As Long) As Long
    
    
    

    SCadCOGO.TXT

    ' -----------------------------------------------------------------------------
    '
    ' Copyright (2001) Bentley Systems, Inc., All rights reserved.
    '
    ' MicroStation, InRoads, InRail and MDL are registered trademarks and "MicroCSL"
    ' is a trademark of Bentley Systems, Inc.
    '
    '
    ' Limited permission is hereby granted to reproduce and modify this
    ' copyrighted material provided that the resulting code is used only
    ' in conjunction with Bentley Systems products under the terms of the
    ' license agreement provided therein, and that this notice is retained
    ' in its entirety in any such reproduction or modification.
    '
    ' -----------------------------------------------------------------------------
    '
    ' SCadCogo.TXT -- InRoads Geometry API Declarations for Visual BAsic
    '
    ' This file contains only the Const, Type,
    ' and Public Declare statements for  InRoads Geometry APIs.
    '
    ' -----------------------------------------------------------------------------
    
    '**************************
    '   CONSTANT Declarations
    '**************************
    
    ' Alignment Types
    Public Const IGNORE = &H0
    Public Const ALG_PROJECT = &H1
    Public Const ALG_COGO = &H2
    Public Const ALG_HORIZONTAL = &H4
    Public Const ALG_VERTICAL = &H8
    Public Const ALG_EQUATION = &H10
    Public Const ALG_H_EVENT = &H20
    Public Const ALG_V_EVENT = &H40
    Public Const ALG_SUPER = &H80
    Public Const ALG_TURNOUT = &H400
    Public Const ALG_TURNOUT_POINTS = &H1000
    
    ' Element Types
    Public Const ELE_NOMASK = &H80000000
    Public Const H_ELE_LINE = &H1
    Public Const H_ELE_CIRCLE = &H2
    Public Const H_ELE_SPIRAL = &H4
    Public Const V_ELE_LINE = &H8
    Public Const V_ELE_CIRCLE = &H10
    Public Const V_ELE_PARABOLA = &H20
    Public Const H_EVENT_POINT_STN = &H40
    Public Const H_EVENT_POINT_XY = &H80
    Public Const V_EVENT_POINT = &H100
    Public Const H_COGO_POINT = &H200
    Public Const G_EQUATION_POINT = &H400
    Public Const H_SUP_APPSTNV1 = &H800
    Public Const CANT_POINT = &H2000
    Public Const H_REGRESSION_POINT = &H2000000
    Public Const V_REGRESSION_POINT = &H4000000
    
    ' Spiral Types
    Public Const H_ELE_SPIRAL_CLOTHOID = &H1
    Public Const H_ELE_SPIRAL_BLOSS = &H2
    Public Const H_ELE_SPIRAL_HALF_BLOSS = &H4
    Public Const H_ELE_SPIRAL_SINUSOID = &H8
    Public Const H_ELE_SPIRAL_HALF_SINUSOID = &H10
    Public Const H_ELE_SPIRAL_CUBIC = &H20
    Public Const H_ELE_SPIRAL_BIQUADRATIC = &H40
    Public Const H_ELE_SPIRAL_HALF_BIQUADRATIC = &H100
    Public Const H_ELE_SPIRAL_COSINE = &H200
    Public Const H_ELE_SPIRAL_HALF_COSINE = &H400
    
    'Cant Types
    Public Const ALG_LINEAR_CANT = &H0
    Public Const ALG_CLOTHOID_CANT = &H400
    Public Const ALG_BLOSS_CANT = &H800
    Public Const ALG_SINUSOID_CANT = &H1000
    Public Const ALG_CUBIC_CANT = &H2000
    Public Const ALG_BIQUADRATIC_CANT = &H4000
    Public Const ALG_COSINE_CANT = &H10000
    
    'Curvature Cant Types
    Public Const LEFT_CURVATURE = -1
    Public Const RIGHT_CURVATURE = 1
    
    ' Curve Definitions
    Public Const H_CURVE_DEFINITION = 0
    Public Const H_CHORD_DEFINITION = 0
    Public Const H_ARC_DEFINITION = 1
    Public Const V_PARABOLIC_DEFINITION = 0
    Public Const V_CIRCULAR_DEFINITION = 1
    
    ' String Sizes
    Public Const ALGFILSZ = 256
    Public Const ALGNAMSZ = 64
    Public Const ALGDESSZ = 40
    Public Const ALGDSCSZ = 80
    Public Const ALGFTRSZ = 32
    Public Const ALGPNTSZ = 24
    
    ' Return Values
    Public Const ALG_W_NO_SOLUTION = 503
    
    ' Turnout Points
    Public Const POINT_0 = ".0"
    Public Const POINT_1 = ".1"
    Public Const POINT_2 = ".2"
    Public Const POINT_3 = ".3"
    Public Const POINT_4 = ".4"
    Public Const POINT_5 = ".5"
    Public Const POINT_53 = "53"
    Public Const POINT_54 = "54"
    Public Const POINT_61 = ".61"
    Public Const POINT_62 = ".62"
    Public Const THEORETICAL_POINT_1 = "Theoretical .1"
    
    ' Turnout Types
    Public Const TURNOUT_TYPE_SINGLE = 1
    Public Const TURNOUT_TYPE_DOUBLE = 2
    Public Const TURNOUT_TYPE_SINGLE_SLIP = 4
    Public Const TURNOUT_TYPE_DOUBLE_SLIP = 8
    Public Const TURNOUT_TYPE_DIAMOND_CROSSING = 16
    
    ' Turnout Bent Status
    Public Const bent = &H1
    Public Const NOT_BENT = &H2
    Public Const BENT_CONCAVE = &H4
    Public Const BENT_CONVEX = &H8
    Public Const BENT_LINEAR = &H10
    
    
    ' General Purpose
    Public Const INFINITE = 1E+38
    
    Type HorizontalCurveSet
        PI As Point3d
        spiralType1 As Long
        unused1 As Long
        spiralLength1 As Double
        radius As Double
        spiralType2 As Long
        unused2 As Long
        spiralLength2 As Double
        tangentLength1 As Double
        tangentLength2 As Double
    End Type
    
    
    Type VerticalCurveSet
        PI As Point2d
        spiralLength1 As Double
        radius As Double
        spiralLength2 As Double
    End Type
    
    Type CogoPointInfo
        pnt As Point3d
        Name As Long
        desc As Long
        feat As Long
    End Type
    
    Type PVIData
        stn As Double
        elev As Double
        vcl As Double       ' parabola left length
        vcr As Double       ' parabola right length
        rad As Double       ' circle radius
        tan As Double       ' tangent
        type As Integer     ' pvi type - V_ELE_LINE, V_ELE_PARABOLA, V_ELE_CIRCLE
    End Type
    
    Type RegressionPointInfo
        pnt As Point3d
        Name As Long
        desc As Long
        feat As Long
        stn As Double
        offset As Double
    End Type
    
    '**************************
    '   FUNCTION Declarations
    '**************************
    
    ' General functions
    Public Declare Function scadSDK_cogoGetActiveStyle Lib "SCadSDKAT" (ByVal nType As Integer, ByVal style As Long) As Long
    
    ' Project functions
    Public Declare Function scadSDK_cogoGetActiveProject Lib "SCadSDKAT" (prj As Long) As Long
    Public Declare Function scadSDK_cogoSetActiveProject Lib "SCadSDKAT" (ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoCountNumberOfProjects Lib "SCadSDKAT" () As Long
    Public Declare Function scadSDK_cogoGetProjects Lib "SCadSDKAT" (prj As Long, count As Long) As Long
    Public Declare Function scadSDK_cogoProjectInfoGet Lib "SCadSDKAT" (ByVal file As Long, ByVal Name As Long, ByVal desc As Long, ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoLoadGeometryFile Lib "SCadSDKAT" (prj As Long, ByVal FileName As Long) As Long
    Public Declare Function scadSDK_cogoCreateProject Lib "SCadSDKAT" (prj As Long, ByVal Name As Long, ByVal desc As Long) As Long
    Public Declare Function scadSDK_cogoTransformProject Lib "SCadSDKAT" (ByVal prj As Long, ByVal angle As Double, ByVal xTrans As Double, ByVal yTrans As Double, ByVal zTrans As Double, ByVal xScale As Double, ByVal yScale As Double) As Long
    Public Declare Function scadSDK_cogoRemoveProject Lib "SCadSDKAT" (ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoSaveProject Lib "SCadSDKAT" (ByVal FileName As Long, ByVal prj As Long) As Long
    
    
    ' General Alignment routines
    Public Declare Function scadSDK_cogoAlignmentInfoGet Lib "SCadSDKAT" (ByVal Name As Long, ByVal desc As Long, ByVal feat As Long, ByVal pAlg As Long) As Long
    Public Declare Function scadSDK_cogoAlignmentInfoSet Lib "SCadSDKAT" (ByVal Name As Long, ByVal desc As Long, ByVal feat As Long, ByVal pAlg As Long) As Long
    Public Declare Function scadSDK_cogoAlignmentType Lib "SCadSDKAT" (ByVal pAlg As Long) As Long
    Public Declare Function scadSDK_cogoFindElevationByStation Lib "SCadSDKAT" (elevation As Double, ByVal alg As Long, ByVal station As Double) As Long
    Public Declare Function scadSDK_cogoFindFirstStationOnAlignment Lib "SCadSDKAT" (stn As Double, ByVal alg As Long) As Long
    Public Declare Function scadSDK_cogoFindLastStationOnAlignment Lib "SCadSDKAT" (stn As Double, ByVal alg As Long) As Long
    Public Declare Function scadSDK_cogoStationOffsetToXY Lib "SCadSDKAT" (pnt As Point3d, tangentialAzimuth As Double, ByVal halg As Long, ByVal station As Double, ByVal offset As Double) As Long
    Public Declare Function scadSDK_cogoXyToStationOffset Lib "SCadSDKAT" (station As Double, offset As Double, azimuth As Double, ByVal halg As Long, pnt As Point3d) As Long
    Public Declare Function scadSDK_cogoGetCountAlignmentAlignmentIntersect Lib "SCadSDKAT" (ByVal alg1 As Long, offset1 As Double, ByVal alg2 As Long, offset2 As Double) As Long
    Public Declare Function scadSDK_cogoAlignmentAlignmentIntersect Lib "SCadSDKAT" (dpts As Point3d, ByVal alg1 As Long, offset1 As Double, ByVal alg2 As Long, offset2 As Double) As Long
    Public Declare Function scadSDK_cogoGetCountElementElementIntersect Lib "SCadSDKAT" (ByVal ele1 As Long, offset1 As Double, ByVal ele2 As Long, offset2 As Double) As Long
    Public Declare Function scadSDK_cogoElementElementIntersect Lib "SCadSDKAT" (dpts As Point3d, ByVal ele1 As Long, offset1 As Double, ByVal ele2 As Long, offset2 As Double) As Long
    Public Declare Function scadSDK_cogoGetCountElementAlignmentIntersect Lib "SCadSDKAT" (ByVal ele As Long, eleOffset As Double, ByVal alg As Long, algOffset As Double) As Long
    Public Declare Function scadSDK_cogoElementAlignmentIntersect Lib "SCadSDKAT" (dpts As Point3d, ByVal ele As Long, eleOffset As Double, ByVal alg As Long, algOffset As Double) As Long
    Public Declare Function scadSDK_cogoSetIsFiniteIntersection Lib "SCadSDKAT" (flag As Long) As Long
    Public Declare Function scadSDK_cogoIsFiniteIntersection Lib "SCadSDKAT" () As Long
    Public Declare Function scadSDK_cogoInitialize3DStationing Lib "SCadSDKAT" (ByVal alg As Long) As Long
    Public Declare Function scadSDK_cogo2DStationTo3DStation Lib "SCadSDKAT" (ByVal stnIn As Double, stnOut As Double) As Long
    Public Declare Function scadSDK_cogo3DStationTo2DStation Lib "SCadSDKAT" (ByVal stnIn As Double, stnOut As Double) As Long
    Public Declare Function scadSDK_cogoUninitialize3DStationing Lib "SCadSDKAT" () As Long
    Public Declare Function scadSDK_cogoCompute3DStationToXyzEtal Lib "SCadSDKAT" (ByVal halg As Long, ByVal valg As Long, ByVal sAlg As Long, ByVal stn3D As Double, stn2D As Double, pnt As Point3d, tangential As Double, radial As Double, instRadius As Double, beta As Double, instVRadius As Double, alpha As Double, designSpeed As Double) As Long
    Public Declare Function scadSDK_cogoComputeAlignmentArea Lib "SCadSDKAT" (ByVal alg As Long, area As Double) As Long
    Public Declare Function scadSDK_cogoComputeArea Lib "SCadSDKAT" (ByVal npts As Long, pts As Double, area As Double) As Long
    Public Declare Function scadSDK_cogoComputeAlignmentRange Lib "SCadSDKAT" (ByVal alg As Long, minimum As Point3d, maximum As Point3d) As Long
    
    Public Declare Function scadSDK_cogoComputeAlignmentLength Lib "SCadSDKAT" (ByVal alg As Long, length As Double) As Long
    Public Declare Function scadSDK_cogoComputeLength Lib "SCadSDKAT" (ByVal npts As Long, pts As Double, len2D As Double, len3d As Double) As Long
    Public Declare Function scadSDK_cogoComputeCantAtStation Lib "SCadSDKAT" (ByVal alg As Long, ByVal stn As Double, leftRail As Double, rightRail As Double, designSpeed As Double) As Long
    Public Declare Function scadSDK_cogoComputeRadiusAtStation Lib "SCadSDKAT" (ByVal alg As Long, ByVal ele As Long, ByVal station As Double, radius As Double, sign As Double) As Long
    Public Declare Function scadSDK_cogoStationToString Lib "SCadSDKAT" (ByVal alg As Long, ByVal station As Double, ByVal format As Long, ByVal decimals As Long, ByVal stationString As Long) As Long
    Public Declare Function scadSDK_cogoStringToStation Lib "SCadSDKAT" (ByVal alg As Long, station As Double, ByVal stationString As Long) As Long
    Public Declare Function scadSDK_cogoDoubleToString Lib "SCadSDKAT" (ByVal doubleValue As Double, ByVal doubleType As Long, ByVal doubleString As Long) As Long
    Public Declare Function scadSDK_cogoStringToDouble Lib "SCadSDKAT" (doubleValue As Double, ByVal doubleType As Long, ByVal doubleString As Long) As Long
    Public Declare Function scadSDK_cogoGetStationType Lib "SCadSDKAT" (ByVal alg As Long, ByVal station As Double, ByVal stationType As Long) As Long
    Public Declare Function scadSDK_cogoOffsetAlignment Lib "SCadSDKAT" (ByVal newAlg As Long, ByVal originalAlg As Long, offset As Double) As Long
    Public Declare Function scadSDK_cogoAlignmentTranspose Lib "SCadSDKAT" (ByVal pAlg As Long) As Long
    Public Declare Function scadSDK_cogoFixDiscontinuities Lib "SCadSDKAT" (ByVal pAlg As Long) As Long
    
    ' Horizontal Alignment routines
    Public Declare Function scadSDK_cogoGetActiveHorizontalAlignment Lib "SCadSDKAT" (halg As Long, ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoSetActiveHorizontalAlignment Lib "SCadSDKAT" (ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoCountNumberOfHorizontals Lib "SCadSDKAT" (ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoGetHorizontalAlignments Lib "SCadSDKAT" (halg As Long, count As Long, ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoFindHorizontalAlignmentByName Lib "SCadSDKAT" (halg As Long, ByVal prj As Long, ByVal Name As Long) As Long
    Public Declare Function scadSDK_cogoFindFirstPointOnHorizontalAlignment Lib "SCadSDKAT" (pnt As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoFindLastPointOnHorizontalAlignment Lib "SCadSDKAT" (pnt As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoSetInitialStationing Lib "SCadSDKAT" (ByVal halg As Long, ByVal delta As Double) As Long
    Public Declare Function scadSDK_cogoTransformHorizontalAlignment Lib "SCadSDKAT" (ByVal prj As Long, ByVal halg As Long, ByVal angle As Double, ByVal xTrans As Double, ByVal yTrans As Double, ByVal zTrans As Double, ByVal xScale As Double, ByVal zScale As Double) As Long
    Public Declare Function scadSDK_cogoFindClosestHorizontalAlignment Lib "SCadSDKAT" (halg As Long, ByVal prj As Long, pnt As Point3d) As Long
    Public Declare Function scadSDK_cogoCreateHorizontalAlignment Lib "SCadSDKAT" (halg As Long, ByVal Name As Long, ByVal desc As Long, ByVal feat As Long) As Long
    Public Declare Function scadSDK_cogoRemoveHorizontalAlignment Lib "SCadSDKAT" (ByVal prj As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoHorizontalAlignmentFromCurveSets Lib "SCadSDKAT" (ByVal halg As Long, curveSet As HorizontalCurveSet, ByVal cnt As Long) As Long
    Public Declare Function scadSDK_cogoHorizontalAlignmentGetCurveType Lib "SCadSDKAT" (ByVal halg As Long, curveType As Long) As Long
    
    ' Vertical Alignment routines
    Public Declare Function scadSDK_cogoGetActiveVerticalAlignment Lib "SCadSDKAT" (valg As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoSetActiveVerticalAlignment Lib "SCadSDKAT" (ByVal valg As Long) As Long
    Public Declare Function scadSDK_cogoCountNumberOfVerticals Lib "SCadSDKAT" (ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoGetVerticalAlignments Lib "SCadSDKAT" (valg As Long, count As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoFindVerticalAlignmentByName Lib "SCadSDKAT" (valg As Long, ByVal halg As Long, ByVal Name As Long) As Long
    Public Declare Function scadSDK_cogoFindFirstPointOnVerticalAlignment Lib "SCadSDKAT" (pnt As Long, ByVal valg As Long) As Long
    Public Declare Function scadSDK_cogoFindLastPointOnVerticalAlignment Lib "SCadSDKAT" (pnt As Long, ByVal valg As Long) As Long
    Public Declare Function scadSDK_cogoTransformVerticalAlignment Lib "SCadSDKAT" (ByVal alg As Long, ByVal xTrans As Double, ByVal yTrans As Double, ByVal xScale As Double, ByVal yScale As Double) As Long
    Public Declare Function scadSDK_cogoCreateVerticalAlignment Lib "SCadSDKAT" (valg As Long, ByVal Name As Long, ByVal desc As Long, ByVal feat As Long) As Long
    Public Declare Function scadSDK_cogoRemoveVerticalAlignment Lib "SCadSDKAT" (ByVal prj As Long, ByVal valg As Long) As Long
    Public Declare Function scadSDK_cogoVerticalAlignmentFromPVI Lib "SCadSDKAT" (valg As Long, pvis As Long, ByVal nPvis As Long) As Long
    Public Declare Function scadSDK_cogoVerticalAlignmentFromCurveSets Lib "SCadSDKAT" (ByVal valg As Long, curveSet As VerticalCurveSet, ByVal cnt As Long) As Long
    Public Declare Function scadSDK_cogoInsertVerticalAlignment Lib "SCadSDKAT" (ByVal halg As Long, ByVal valg As Long) As Long
    Public Declare Function scadSDK_cogoVerticalAlignmentGetCurveType Lib "SCadSDKAT" (ByVal valg As Long, curveType As Long) As Long
    
    'Super Elevation routines
    Public Declare Function scadSDK_cogoGetActiveSuperAlignment Lib "SCadSDKAT" (super As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoSetActiveSuperAlignment Lib "SCadSDKAT" (ByVal sAlg As Long) As Long
    Public Declare Function scadSDK_cogoCountNumberOfSuperelevations Lib "SCadSDKAT" (ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoGetSuperAlignments Lib "SCadSDKAT" (sAlg As Long, count As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoRemoveSuperAlignment Lib "SCadSDKAT" (ByVal prj As Long, ByVal sAlg As Long) As Long
    Public Declare Function scadSDK_cogoCreateSuperAlignment Lib "SCadSDKAT" (ByVal halg As Long, ByVal sAlg As Long, ByVal rateTable As Long, ByVal speedTable As Long) As Long
    
    'Cant Alignment rountines
    Public Declare Function scadSDK_cogoAddCantStation Lib "SCadSDKAT" (ByRef ele As Long, ByVal halg As Long, ByVal cAlg As Long, ByVal station As Double, ByVal cant As Double, ByVal designSpeed As Double, ByVal transition As Long, ByVal curvature As Long) As Long
    Public Declare Function scadSDK_cogoAddSpeedChangeOnly Lib "SCadSDKAT" (ByRef ele As Long, ByVal halg As Long, ByVal cAlg As Long, ByVal station As Double, ByVal designSpeed As Double) As Long
    Public Declare Function scadSDK_cogoCreateCantAlignment Lib "SCadSDKAT" (sAlg As Long, ByVal Name As Long, ByVal Description As Long) As Long
    
    ' Cogo Point Buffer routines
    Public Declare Function scadSDK_cogoGetActiveCogoAlignment Lib "SCadSDKAT" (cAlg As Long, ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoCogoPointGetInfo Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, X As Double, y As Double, z As Double, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoAddCogoPoint Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, ByVal pPnt As Long) As Long
    Public Declare Function scadSDK_cogoAddCogoPoints Lib "SCadSDKAT" (ByVal pPnts As CogoPointInfo, nPnts As Long, ByVal prj As Long) As Long
    
    ' Horizontal Event Buffer routines
    Public Declare Function scadSDK_cogoGetActiveHorizontalEventBuffer Lib "SCadSDKAT" (hBuf As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoHorizontalEventPointGetInfo Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, X As Double, y As Double, z As Double, stn As Double, offset As Double, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoAddHorizontalEventPointFromStationOffset Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, ByVal stn As Double, ByVal offset As Double, ByVal halg As Long, ByVal pntType As Long) As Long
    Public Declare Function scadSDK_cogoAddHorizontalEventPointFromXY Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, ByVal X As Double, ByVal y As Double, ByVal z As Double, ByVal halg As Long, ByVal pntType As Long) As Long
    
    ' Horizontal Regression functions
    Public Declare Function scadSDK_cogoHorizontalRegressionPointGetInfo Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, X As Double, y As Double, z As Double, stn As Double, offset As Double, fixedOff As Double, weight As Double, status As Long, status2 As Long, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoAddHorizontalRegressionPoint Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, ByVal X As Double, ByVal y As Double, ByVal z As Double, ByVal stn As Double, ByVal offset As Double, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoAddHorizontalRegressionPoints Lib "SCadSDKAT" (ByVal pPnts As RegressionPointInfo, nPnts As Long, ByVal halg As Long) As Long
    
    ' Vertical Event Buffer routines
    Public Declare Function scadSDK_cogoGetActiveVerticalEventBuffer Lib "SCadSDKAT" (vBuf As Long, ByVal valg As Long) As Long
    Public Declare Function scadSDK_cogoVerticalEventPointGetInfo Lib "SCadSDKAT" (ByVal feat As Long, ByVal desc As Long, stn As Double, elev As Double, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoAddVerticalEventPoint Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, ByVal stn As Double, ByVal elev As Double, ByVal valg As Long) As Long
    
    ' Vertical Regression functions
    Public Declare Function scadSDK_cogoVerticalRegressionPointGetInfo Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, stn As Double, elev As Double, fixedOff As Double, weight As Double, status As Long, status2 As Long, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoAddVerticalRegressionPoint Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, ByVal stn As Double, ByVal elev As Double, ByVal valg As Long) As Long
    
    ' Station Equation routines
    Public Declare Function scadSDK_cogoGetActiveStationEquationBuffer Lib "SCadSDKAT" (seAlg As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoStationEquationGetInfo Lib "SCadSDKAT" (ByVal bckEqn As Long, ByVal ahdEqn As Long, stn As Double, bck As Double, ahd As Double, X As Double, y As Double, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoInsertStationEquation Lib "SCadSDKAT" (ByVal bckEqn As Long, ByVal ahdEqn As Long, ByVal stn As Double, ByVal bck As Double, ByVal ahd As Double, ByVal X As Double, ByVal y As Double, ByVal halg As Long) As Long
    
    ' Turnout routines
    Public Declare Function scadSDK_cogoGetActiveTurnoutAlignment Lib "SCadSDKAT" (tAlg As Long, ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoCountNumberOfTurnouts Lib "SCadSDKAT" (ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoGetTurnoutAlignments Lib "SCadSDKAT" (tAlgs As Long, cnt As Long, ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoGetTurnoutPoint Lib "SCadSDKAT" (tPnt As Long, ByVal tAlg As Long, ByVal heel As Long, ByVal pointName As Long) As Long
    Public Declare Function scadSDK_cogoTransformTurnout Lib "SCadSDKAT" (ByVal tAlg As Long, ByVal angle As Double, ByVal xTrans As Double, ByVal yTrans As Double, ByVal zTrans As Double, ByVal xScale As Double, ByVal yScale As Double) As Long
    Public Declare Function scadSDK_cogoRemoveTurnoutAlignment Lib "SCadSDKAT" (ByVal prj As Long, ByVal tAlg As Long) As Long
    Public Declare Function scadSDK_cogoGetTurnoutMainLineExtents Lib "SCadSDKAT" (ByVal prj As Long, ByVal tAlg As Long, halg As Long, first As Long, last As Long, forward As Long) As Long
    Public Declare Function scadSDK_cogoGetTurnoutType Lib "SCadSDKAT" (ByVal tAlg As Long, toType As Long)
    Public Declare Function scadSDK_cogoIsTurnoutBent Lib "SCadSDKAT" (ByVal tAlg As Long, bent As Long)
    
    ' General Element routines
    Public Declare Function scadSDK_cogoCountNumberOfElements Lib "SCadSDKAT" (ByVal alg As Long) As Long
    Public Declare Function scadSDK_cogoElementType Lib "SCadSDKAT" (ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoElementFirst Lib "SCadSDKAT" (ByVal alg As Long) As Long
    Public Declare Function scadSDK_cogoElementLAst Lib "SCadSDKAT" (ByVal alg As Long) As Long
    Public Declare Function scadSDK_cogoElementNext Lib "SCadSDKAT" (ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoElementPrevious Lib "SCadSDKAT" (ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoElementByIndex Lib "SCadSDKAT" (ByVal alg As Long, ByVal index As Long) As Long
    Public Declare Function scadSDK_cogoDeleteElement Lib "SCadSDKAT" (ByVal ele As Long, ByVal alg As Long) As Long
    Public Declare Function scadSDK_cogoFindClosestElementByStation Lib "SCadSDKAT" (ele As Long, ByVal alg As Long, stn As Double) As Long
    Public Declare Function scadSDK_cogoNumberOfStrokes Lib "SCadSDKAT" (ByVal chordHeightTolerance As Double, ByVal ele As Long, numStrokes As Long) As Long
    Public Declare Function scadSDK_cogoStrokeElement Lib "SCadSDKAT" (vertices As Double, ByVal ele As Long, ByVal numStrokes As Long) As Long
    Public Declare Function scadSDK_cogoStrokeHorizontalElement Lib "SCadSDKAT" (vertices As Point3d, ByVal ele As Long, ByVal numStrokes As Long) As Long
    Public Declare Function scadSDK_cogoStrokeVerticalElement Lib "SCadSDKAT" (vertices As Point2d, ByVal ele As Long, ByVal numStrokes As Long) As Long
    Public Declare Function scadSDK_cogoGetElementDirections Lib "SCadSDKAT" (ByVal ele As Long, enterDir As Double, exitDir As Double, chordDir As Double) As Long
    
    ' Horizontal Element routines
    Public Declare Function scadSDK_cogoHorizontalElementGetEndPoints Lib "SCadSDKAT" (startPt As Long, endPt As Long, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoHorizontalCircleGetInfo Lib "SCadSDKAT" (pc As Long, cc As Long, pt As Long, delta As Double, radius As Double, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoHorizontalCircleGetExtendedInfo Lib "SCadSDKAT" (pc As Long, cc As Long, pt As Long, PI As Point2d, ByVal feat As Long, delta As Double, radius As Double, arcLength As Double, degreeOfCurvature As Double, chordLength As Double, tangentLength As Double, middleOrdinate As Double, external As Double, segmentArea As Double, sectorArea As Double, ByVal chordDefinition As Long, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoHorizontalSpiralGetInfo Lib "SCadSDKAT" (bs As Long, PI As Long, es As Long, length As Double, a As Double, entranceRadius As Double, exitRadius As Double, subType As Long, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoHorizontalSpiralGetExtendedInfo Lib "SCadSDKAT" (bs As Long, PI As Long, es As Long, ByVal feat As Long, entranceRadius As Double, exitRadius As Double, length As Double, theta As Double, ks As Double, p As Double, ys As Double, xs As Double, longChordLength As Double, shortTangentLength As Double, longTangentLength As Double, a As Double, subType As Long, method As Long, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoHorizontalCountNumberOfCurveSets Lib "SCadSDKAT" (count As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoHorizontalCurveSetGetInfo Lib "SCadSDKAT" (first As Long, last As Long, PI As Long, delta As Double, ts1 As Double, ts2 As Double, ext As Double, superRate As Double, curveSetIndex As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoFindClosestHorizontalElement Lib "SCadSDKAT" (ele As Long, ByVal halg As Long, pnt As Point3d) As Long
    Public Declare Function scadSDK_cogoAddHorizontalLineByDirectionNLength Lib "SCadSDKAT" (ele As Long, ByVal halg As Long, point As Point3d, ByVal azimuth As Double, ByVal length As Double) As Long
    Public Declare Function scadSDK_cogoAddHorizontalLineByPoints Lib "SCadSDKAT" (ele As Long, ByVal halg As Long, point1 As Point3d, point2 As Point3d) As Long
    Public Declare Function scadSDK_cogoAddHorizontalCircularByPointsOnArc Lib "SCadSDKAT" (ele As Long, ByVal halg As Long, point1 As Point3d, point2 As Point3d, point3 As Point3d) As Long
    Public Declare Function scadSDK_cogoAddHorizontalCircularByTwoPointsAndRadius Lib "SCadSDKAT" (ele As Long, ByVal halg As Long, point1 As Point3d, point2 As Point3d, ByVal radius As Double, ByVal longSolution As Long) As Long
    Public Declare Function scadSDK_cogoAddHorizontalCircularByLengthRadius Lib "SCadSDKAT" (ele As Long, ByVal halg As Long, point As Point3d, ByVal az As Double, ByVal length As Double, ByVal radius As Double) As Long
    Public Declare Function scadSDK_cogoAddHorizontalSpiralByLengthRadii Lib "SCadSDKAT" (ele As Long, ByVal halg As Long, point As Point3d, ByVal az As Double, ByVal length As Double, ByVal entr As Double, ByVal extr As Double, ByVal subType As Long) As Long
    Public Declare Function scadSDK_cogoAddHorizontalSpiralByTwoPointsLengthRadii Lib "SCadSDKAT" (ele As Long, ByVal halg As Long, point1 As Point3d, point2 As Point3d, ByVal length As Double, ByVal entr As Double, ByVal extr As Double, ByVal subType As Long) As Long
    
    ' Vertical Element routines
    Public Declare Function scadSDK_cogoVerticalElementGetEndPoints Lib "SCadSDKAT" (startPt As Long, endPt As Long, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoVerticalParabolaGetInfo Lib "SCadSDKAT" (pvc As Long, pvi As Long, pvt As Long, length As Double, rate As Double, k As Double, entranceSlope As Double, exitSlope As Double, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoVerticalCircleGetInfo Lib "SCadSDKAT" (pvc As Long, pvi As Long, pvt As Long, radius As Double, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoFindClosestVerticalElement Lib "SCadSDKAT" (ele As Long, ByVal valg As Long, pnt As Point3d) As Long
    Public Declare Function scadSDK_cogoAddVerticalLineByDirectionNLength Lib "SCadSDKAT" (ele As Long, ByVal valg As Long, point As Point2d, ByVal slope As Double, ByVal length As Double) As Long
    Public Declare Function scadSDK_cogoAddVerticalLineByPoints Lib "SCadSDKAT" (ele As Long, ByVal valg As Long, point1 As Point2d, point2 As Point2d) As Long
    Public Declare Function scadSDK_cogoAddVerticalParabolaBy1PointK Lib "SCadSDKAT" (ele As Long, ByVal valg As Long, point As Point2d, ByVal slope As Double, ByVal length As Double, ByVal k As Double) As Long
    Public Declare Function scadSDK_cogoAddVerticalParabolaBy2Points Lib "SCadSDKAT" (ele As Long, ByVal valg As Long, point1 As Point2d, ByVal slope1 As Double, point2 As Point2d, ByVal slope2 As Double) As Long
    Public Declare Function scadSDK_cogoAddVerticalParabolaBy3Points Lib "SCadSDKAT" (ele As Long, ByVal valg As Long, point1 As Point2d, point2 As Point2d, point3 As Point2d) As Long
    Public Declare Function scadSDK_cogoAddVerticalCircleByLengthRadius Lib "SCadSDKAT" (ele As Long, ByVal valg As Long, point As Point2d, ByVal slope As Double, ByVal length As Double, ByVal radius As Double) As Long
    Public Declare Function scadSDK_cogoAddVerticalCircleByPoints Lib "SCadSDKAT" (ele As Long, ByVal valg As Long, point1 As Point2d, point2 As Point2d, point3 As Point2d) As Long
    
    ' Horizontal Point functions
    Public Declare Function scadSDK_cogoHorizontalPointGetInfo Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, X As Double, y As Double, z As Double, station As Double, offset As Double, ByVal pnt As Long) As Long
    
    ' Vertical Point functions
    Public Declare Function scadSDK_cogoVerticalPointGetInfo Lib "SCadSDKAT" (ByVal feat As Long, ByVal desc As Long, station As Double, elevation As Double, ByVal pnt As Long) As Long
    
    ' Turnout point functions
    Public Declare Function scadSDK_cogoTurnoutPointGetInfo Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, X As Double, y As Double, z As Double, az As Double, rb As Double, re As Double, ByVal pnt As Long) As Long

    I have another module that is used to setup the environment variables. Here is the code.

    Option Explicit
    
    Declare Function GetEnvironmentVariable Lib "kernel32" _
        Alias "GetEnvironmentVariableA" ( _
        ByVal lpName As String, _
        ByVal lpBuffer As String, _
        ByVal nSize As Long) As Long
    
    Declare Function SetEnvironmentVariable Lib "kernel32" _
        Alias "SetEnvironmentVariableA" ( _
        ByVal lpName As String, _
        ByVal lpValue As String) As Long
    
    Private Function GetEV(strName As String) As String
        Dim theSize As Long
        Dim strValue As String
    
        theSize = GetEnvironmentVariable(strName, vbNullString, 0)
        GetEV = Space(theSize)
        GetEnvironmentVariable strName, GetEV, theSize
        GetEV = Left(GetEV, theSize - 1)
    End Function
    
    Public Sub AppendToVar(strEnvVarName As String, strSuffix As String)
        Dim strValue As String
        
        strValue = GetEV("PATH")
        strValue = strValue & strSuffix
        SetEnvironmentVariable strEnvVarName, strValue
    End Sub

    I have 5th module for that has the function I call whenever I want to use InRoads vba commands.

    The function I call at the start of my commands is InRoads_Setup

    Option Explicit
    
    Private Function GetEV(strName As String) As String
        Dim theSize As Long
        Dim strValue As String
    
        theSize = GetEnvironmentVariable(strName, vbNullString, 0)
        
        GetEV = Space(theSize)
        GetEnvironmentVariable strName, GetEV, theSize
        GetEV = Left(GetEV, theSize - 1)
    End Function
    
    Private Sub AppendToVar(strEnvVarName As String, strSuffix As String)
        Dim strValue As String
        
        strValue = GetEV("PATH")
    '    Debug.Print strValue
        If InStr(1, strValue, strSuffix, vbTextCompare) = 0 Then
            If Len(strValue) > 0 Then strValue = strValue & ";"
            strValue = strValue & strSuffix
            SetEnvironmentVariable strEnvVarName, strValue
        End If
    End Sub
    
    Public Sub InRoads_Setup()
        AppendToVar "PATH", "C:\Program Files (x86)\Bentley\InRoads Group V8.11\bin\"
        AppendToVar "PATH", "C:\Program Files (x86)\Bentley\InRoads Group V8.11\bin\ustationdlls\"
    End Sub


    The above was just to get started.  Now for the code I have to get profile info.  The routine below gets me the PVI data sta, elev and curve length.

    First I need to get a long variable m_lngAlgFile for the alg file and I also populate a listbox with all the alignment names

    Function AddItemAlignNames(lbox As ListBox) As Boolean
      Dim lngStat As Long
      Dim lngPrj As Long
      
      
      Dim lngNum As Long
      Dim lngAlg As Long
      Dim lngAlgs() As Long
      Dim lngIndex As Long
    
      Dim i As Long
      Dim strMsg As String
      
      Dim sFeat As String
      Dim sName As String
      Dim sDesc As String
      
      AddItemAlignNames = False
      'm_lngAlgFile = 0
      lbox.Clear
      If m_lngAlgFile > 0 Then
      
      
      sName = String(ALGNAMSZ, vbNullChar)
      sDesc = String(ALGDSCSZ, vbNullChar)
      scadSDK_cogoProjectInfoGet lngNum, StrPtr(sName), StrPtr(sDesc), m_lngAlgFile
      
      mActiveAlgName = sName
    '  lblGP.Caption = sName
      
      lngNum = scadSDK_cogoCountNumberOfHorizontals(m_lngAlgFile)
      ReDim lngAlgs(lngNum - 1)
      
      
        lngStat = scadSDK_cogoGetHorizontalAlignments( _
            lngAlgs(0), _
            lngNum, _
            m_lngAlgFile)
        If lngStat = SDK_SUCCESS Then
        
        
      '    lstAlignments.Clear
          For lngIndex = 0 To lngNum - 1
            lngAlg = lngAlgs(lngIndex)
            sName = String(ALGNAMSZ, vbNullChar)
            sDesc = String(ALGDSCSZ, vbNullChar)
            sFeat = String(ALGFTRSZ, vbNullChar)
            scadSDK_cogoAlignmentInfoGet StrPtr(sName), StrPtr(sDesc), StrPtr(sFeat), lngAlg
            lbox.AddItem sName
          Next lngIndex
      
      
      
      
      
          AddItemAlignNames = True
        End If
      End If
      
    End Function

    When I select an alignment name in the listbox I set the long variable for the alignment m_lngAlign

    Function OpenAlignment() As Boolean
      Dim lngStat As Long
      OpenAlignment = False
      If m_lngAlgFile > 0 Then
        lngStat = scadSDK_cogoFindHorizontalAlignmentByName(m_lngAlign, m_lngAlgFile, StrPtr(mAlign))
        If lngStat = SDK_SUCCESS Then
          OpenAlignment = True
          lngStat = scadSDK_cogoFindFirstStationOnAlignment(mBegSta, ByVal m_lngAlign)
          'If lngStat <> SDK_SUCCESS Then GoTo Error_GetStation
          
          lngStat = scadSDK_cogoFindLastStationOnAlignment(mEndSta, ByVal m_lngAlign)
          'If lngStat <> SDK_SUCCESS Then GoTo Error_GetStation
          
        Else
          m_lngAlign = 0
        End If
      Else
        m_lngAlign = 0
      End If
    End Function

    and populate another listbox with the alignments profiles

    Function AddItemProfileNames(lbox As ListBox) As Boolean
      Dim lngStat As Long
      Dim lngPrj As Long
      
      Dim lngCount As Long
       Dim lngVerts() As Long
      Dim lngVert As Long
      Dim lngIndex As Long
      Dim sName As String
      Dim sDesc As String
      Dim sFeat As String
      
      AddItemProfileNames = False
      lbox.Clear
      lngCount = scadSDK_cogoCountNumberOfVerticals(m_lngAlign)
      
      If lngCount > 0 Then
        ReDim lngVerts(lngCount - 1)
        
    '      While i < lngCount
      
        lngStat = scadSDK_cogoGetVerticalAlignments( _
            lngVerts(0), _
            lngCount, _
            m_lngAlign)
        If lngStat = SDK_SUCCESS Then
          For lngIndex = 0 To lngCount - 1
            lngVert = lngVerts(lngIndex)
              
            sName = String(ALGNAMSZ, vbNullChar)
            sDesc = String(ALGDSCSZ, vbNullChar)
            sFeat = String(ALGFTRSZ, vbNullChar)
          
            scadSDK_cogoAlignmentInfoGet StrPtr(sName), StrPtr(sDesc), StrPtr(sFeat), lngVert
            lbox.AddItem sName
              
              
          Next lngIndex
          AddItemProfileNames = True
        End If
    
      End If
      
    End Function

    Then I select a profile, set the long variable for the profile and populate another listbox with the PVI sta, elev, and curve length.

    Function AddItemProfileGeomRaw(lbox As ListBox) As Boolean
      AddItemProfileGeomRaw = False
      lbox.Clear
      
      Dim lngStat As Long
      Dim lngAlgFileNo As Long
      Dim lngHAlg As Long
      Dim lngVAlg As Long
      Dim strMsg As String
      Dim lngCount As Long
      Dim strVAlgName As String
      
      Dim i As Integer
      Dim lngType As Long
      Dim lngElement As Long
      Dim lngPt1 As Long
      Dim lngPt2 As Long
      Dim lngPtCc As Long
      Dim lngFeat As Long
      Dim lngDesc As Long
      
      Dim dLen As Double
      Dim dK As Double
      Dim dRate As Double
      Dim dEntranceSlope As Double
      Dim dExitSlope As Double
      
      Dim lngPvi As Long
      Dim lngPvt As Long
      Dim lngPvc As Long
      Dim dElevPvi As Double
      Dim dElevPvc As Double
      Dim dElevPvt As Double
      Dim dStaPvi As Double
      Dim dStaPvc As Double
      Dim dStaPvt As Double
      
      strVAlgName = Me.ProfileName
      
      If strVAlgName = "" Then
        Exit Function
      End If
     
        
      lngHAlg = m_lngAlign
    
      lngStat = scadSDK_cogoFindVerticalAlignmentByName(lngVAlg, lngHAlg, StrPtr(strVAlgName))
      If lngStat <> SDK_SUCCESS Then GoTo Error_FindingHAlg
    
      
      Dim bPrevTangent As Boolean
      Dim bNoPrec As Boolean
      
      bPrevTangent = True
      bNoPrec = True
      
      lngCount = scadSDK_cogoCountNumberOfElements(lngVAlg)
      If lngCount < 1 Then GoTo Error_FindingHAlg
      
      i = 0
      While i < lngCount
        lngElement = scadSDK_cogoElementByIndex(lngVAlg, i)
        lngType = scadSDK_cogoElementType(lngElement)
    
    '''    Public Const V_ELE_LINE = &H8
    '''    Public Const V_ELE_CIRCLE = &H10
    '''    Public Const V_ELE_PARABOLA = &H20
    
        If lngType = V_ELE_LINE Then
    '      lbox.AddItem "** V_ELE_LINE"
          lngStat = scadSDK_cogoVerticalElementGetEndPoints(lngPt1, lngPt2, ByVal lngElement)
      
          If i = 0 Then
            lngStat = scadSDK_cogoVerticalPointGetInfo(lngFeat, lngDesc, dStaPvi, dElevPvi, ByVal lngPt1)
            lbox.AddItem dStaPvi & "  " & dElevPvi
          
          ElseIf i = lngCount - 1 Then
            If bPrevTangent = True Then
              lngStat = scadSDK_cogoVerticalPointGetInfo(lngFeat, lngDesc, dStaPvi, dElevPvi, ByVal lngPt1)
              lbox.AddItem dStaPvi & "  " & dElevPvi
            End If
            
            lngStat = scadSDK_cogoVerticalPointGetInfo(lngFeat, lngDesc, dStaPvi, dElevPvi, ByVal lngPt2)
            lbox.AddItem dStaPvi & "  " & dElevPvi
          Else
            If bPrevTangent = True Then
              lngStat = scadSDK_cogoVerticalPointGetInfo(lngFeat, lngDesc, dStaPvi, dElevPvi, ByVal lngPt1)
              lbox.AddItem dStaPvi & "  " & dElevPvi
            End If
          End If
          bPrevTangent = True
    
        ElseIf lngType = V_ELE_PARABOLA Then
          lngStat = scadSDK_cogoVerticalParabolaGetInfo(lngPvc, lngPvi, lngPvt, dLen, dRate, dK, dEntranceSlope, dExitSlope, ByVal lngElement)
          lngStat = scadSDK_cogoVerticalPointGetInfo(lngFeat, lngDesc, dStaPvi, dElevPvi, ByVal lngPvi)
          lngStat = scadSDK_cogoVerticalPointGetInfo(lngFeat, lngDesc, dStaPvc, dElevPvc, ByVal lngPvc)
          lngStat = scadSDK_cogoVerticalPointGetInfo(lngFeat, lngDesc, dStaPvt, dElevPvt, ByVal lngPvt)
          dLen = dStaPvt - dStaPvc
          'lbox.AddItem format(dStaPvi, "0.000000") & "  " & format(dElevPvi, "0.000000") & "  " & format(dLen, "0.000000") & "  " & format(dEntranceSlope * 100, "0.00") & "  " & format(dExitSlope * 100, "0.00")
          
          ' add pvc if curve first element
          If i = 0 Then
            lbox.AddItem dStaPvc & "  " & dElevPvc
          End If
          
          ' add pvi for curve
          lbox.AddItem dStaPvi & "  " & dElevPvi & "  " & dLen
          
          ' add pvt if curve is last element
          If i = lngCount - 1 Then
            lbox.AddItem dStaPvt & "  " & dElevPvt
          End If
          
          
          bPrevTangent = False
        End If
    
        i = i + 1
      Wend
      
    '  scadSDK_cogoVerticalElementGetEndPoints(startPt As Long, endPt As Long, ByVal ele As Long) As Long
    '  scadSDK_cogoVerticalParabolaGetInfo(pvc As Long, pvi As Long, pvt As Long, length As Double, rate As Double, k As Double, entranceSlope As Double, exitSlope As Double, ByVal ele As Long) As Long
    '  scadSDK_cogoVerticalPointGetInfo Lib "SCadSDKAT" (ByVal feat As Long, ByVal desc As Long, station As Double, elevation As Double, ByVal pnt As Long) As Long
    
      
      
      
    Exit_Sub:
    '    lngStat = scadSDK_cogoRemoveProject(lngAlgFileNo)
        Exit Function
      
      
    Error_FindingHAlg:
        MsgBox "Error finding horizontal alignment!", vbCritical
        GoTo Exit_Sub
         
    Error_LoadAlgFile:
        strMsg = "Error " & Err.Number & ", " & Err.Description
        MsgBox strMsg, vbCritical, "LoadAlgFile"
        GoTo Exit_Sub
    
    End Function

    From there I have commands to copy profile data to the clipboard so I can paste it into a spreadsheet.  Here is a pic of my dialog box.

    Quite a bit of code.  Had some help from a co-worker 10 years ago that got me going.

    Regards,

    Andrew

Reply
  • Saul,

    I get my profile info using vba.  The key is to get the files that have all the InRoads (SCad) declarations in them. 

    The 3 function declaration modules I have came from these text files, Copyright date 2001 from Bentley

    SCadSDK.TXT

    Option Explicit
    
    ' -----------------------------------------------------------------------------
    '
    ' Copyright (2001) Bentley Systems, Inc., All rights reserved.
    '
    ' MicroStation, InRoads, InRail and MDL are registered trademarks and "MicroCSL"
    ' is a trademark of Bentley Systems, Inc.
    '
    '
    ' Limited permission is hereby granted to reproduce and modify this
    ' copyrighted material provided that the resulting code is used only
    ' in conjunction with Bentley Systems products under the terms of the
    ' license agreement provided therein, and that this notice is retained
    ' in its entirety in any such reproduction or modification.
    '
    ' -----------------------------------------------------------------------------
    '
    ' SCadSDK.TXT -- InRoads SDK Declarations for Visual Basic
    '
    ' This file contains only the Const, Type,
    ' and Declare statements for InRoads SDK.
    '
    ' -----------------------------------------------------------------------------
    
    '**************************
    '   CONSTANT Declarations
    '**************************
    
    Public Const SDK_SUCCESS = 0
    Public Const SDK_NOLICENSE = -1
    Public Const SDK_TRUE = 1
    Public Const SDK_FALSE = 0
    Public Const DTM_M_NOINTF = 1120
    '**************************
    '   TYPE Declarations
    '**************************
    
    ' DPoint3d holds a 3 diminsional double point
    Type DPoint3d
        X As Double
        y As Double
        z As Double
    End Type
    
    ' DPoint2d holds a 2 diminsional double point
    Type DPoint2d
        X As Double
        y As Double
    End Type
    
    '**************************
    '   FUNCTION Declarations
    '**************************
    
    'Public Declare Function scadSDK_initialize Lib "c:\program files\bentley\InRoads Group V8.11\bin\SCadSDKAT.dll" () As Long
    'Public Declare Function scadSDK_freeLicense Lib "c:\program files\bentley\InRoads Group V8.11\bin\SCadSDKAT.dll" () As Long
    Public Declare Function scadSDK_initialize Lib "SCadSDKAT" () As Long
    Public Declare Function scadSDK_freeLicense Lib "SCadSDKAT" () As Long
    

    SCadDTM.TXT

    ' -----------------------------------------------------------------------------
    '
    ' Copyright (2001) Bentley Systems, Inc., All rights reserved.
    '
    ' MicroStation, InRoads, InRail and MDL are registered trademarks and "MicroCSL"
    ' is a trademark of Bentley Systems, Inc.
    '
    '
    ' Limited permission is hereby granted to reproduce and modify this
    ' copyrighted material provided that the resulting code is used only
    ' in conjunction with Bentley Systems products under the terms of the
    ' license agreement provided therein, and that this notice is retained
    ' in its entirety in any such reproduction or modification.
    '
    ' -----------------------------------------------------------------------------
    '
    ' SCadDTM.TXT -- InRoads Surface SDK Declarations for Visual Basic
    '
    ' This file contains only the Const, Type,
    ' and Public Declare statements for  InRoads Surface SDK.
    '
    ' -----------------------------------------------------------------------------
    
    '**************************
    '   CONSTANT Declarations
    '**************************
    
    ' String Sizes
    Public Const CIV_C_NAMSIZ = 32
    Public Const CIV_C_DESSIZ = 64
    Public Const CIV_MAX_PATH = 256
    
    ' Profile Offset Indexes
    Public Const DTM_C_PRFOFF1 = 0
    Public Const DTM_C_PRFOFF2 = 1
    Public Const DTM_C_PRFOFF3 = 2
    Public Const DTM_C_PRFOFF4 = 3
    Public Const DTM_C_PRFOFF5 = 4
    Public Const DTM_C_PRFOFF6 = 5
    Public Const DTM_C_PRFOFF7 = 6
    Public Const DTM_C_PRFOFF8 = 7
    Public Const DTM_C_PRFOFF9 = 8
    Public Const DTM_C_PRFOFF10 = 9
    Public Const DTM_C_PRFOFF11 = 10
    Public Const DTM_C_PRFOFF12 = 11
    Public Const DTM_C_PRFOFF13 = 12
    Public Const DTM_C_PRFOFF14 = 13
    Public Const DTM_C_PRFOFF15 = 14
    Public Const DTM_C_PRFOFF16 = 15
    
    ' Number of Profile Offsets
    Public Const DTM_C_NUMPRFOFF = 16
    
    ' Feature types
    Public Const DTM_C_DTMREGFTR = 17      ' random point feature type
    Public Const DTM_C_DTMBRKFTR = 18      ' breakline feature type
    Public Const DTM_C_DTMINTFTR = 19      ' interior boundary feature
    Public Const DTM_C_DTMEXTFTR = 20      ' exterior boundary feature
    Public Const DTM_C_DTMCTRFTR = 21      ' contour feature
    
    
    ' Triangle Set Index Options
    Public Const FIRST_TRIANGLE = 0         ' set index to first triangle
    Public Const LAST_TRIANGLE = 1          ' set index to last triangle
    Public Const MIDDLE_TRIANGLE = 2       ' set index to given triangle
    
    
    '**************************
    '   FUNCTION Declarations
    '**************************
    
    ' General Surface Functions
    Public Declare Function scadSDK_dtmGetRange Lib "SCadSDKAT" (ByVal srf As Long, minP As Point3d, maxP As Point3d) As Long
    Public Declare Function scadSDK_dtmCountSurfaces Lib "SCadSDKAT" (numSrf As Long) As Long
    Public Declare Function scadSDK_dtmGetSurfaces Lib "SCadSDKAT" (srfs As Long, numSrfsP As Long) As Long
    Public Declare Function scadSDK_dtmGetActiveSurface Lib "SCadSDKAT" (srf As Long, ByVal srfName As Long, ByVal srfDesc As Long) As Long
    Public Declare Function scadSDK_dtmSetActiveSurface Lib "SCadSDKAT" (ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmSurfaceFindByName Lib "SCadSDKAT" (srf As Long, ByVal srfName As Long) As Long
    Public Declare Function scadSDK_dtmSurfaceInfoGet Lib "SCadSDKAT" (ByVal Name As Long, ByVal desc As Long, ByVal file As Long, ByVal mat As Long, ByVal pref As Long, ByVal secsymb As Long, ByVal prfSymb As Long, maxTriLength As Double, useFtrsOnlyXSect As Long, useFtrsOnlyPrf As Long, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmGetSurfaceOffset Lib "SCadSDKAT" (dis As Double, ByVal sym As Long, ByVal offsetIndex As Long, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmCountSurfacePoints Lib "SCadSDKAT" (npnt As Long, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmCountSurfacePointsWithRange Lib "SCadSDKAT" (npnt As Long, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmGetSurfaceTotals Lib "SCadSDKAT" (numActTriangle As Long, numDelTriangle As Long, numActRandom As Long, numDelRandom As Long, numActBreak As Long, numDelBreak As Long, numActInferred As Long, numDelInferred As Long, numActContour As Long, numDelContour As Long, numActInterior As Long, numDelInterior As Long, numActExterior As Long, numDelExterior As Long, numActRandomFtr As Long, numDelRandomFtr As Long, numActBreakFtr As Long, numDelBreakFtr As Long, numActContourFtr As Long, numDelContourFtr As Long, numActInteriorFtr As Long, numDelInteriorFtr As Long, numActExteriorFtr As Long, numDelExteriorFtr As Long, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmCountBoundaries Lib "SCadSDKAT" (numInt As Long, numExt As Long, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmCountSurfaceFeatures Lib "SCadSDKAT" (nftr As Long, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmGetSurfaceElevationAtXY Lib "SCadSDKAT" (pnt As Point3d, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmSurfaceInfoSet Lib "SCadSDKAT" (ByVal Name As Long, ByVal desc As Long, ByVal file As Long, ByVal mat As Long, ByVal pref As Long, ByVal secsymb As Long, ByVal prfSymb As Long, maxTriLength As Double, useFtrsOnlyXSect As Long, useFtrsOnlyPrf As Long, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmSetSurfaceOffset Lib "SCadSDKAT" (ByVal dis As Double, ByVal sym As Long, ByVal offsetIndex As Long, ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmIntersectLineAndSurface Lib "SCadSDKAT" (pntP As Point3d, ByVal srf As Long, ByVal srfElevAdj As Double, linP As Point3d) As Long
    Public Declare Function scadSDK_dtmSurfaceTriangulate Lib "SCadSDKAT" (ByVal srf As Long, ByVal bExtendedDataChecks As Long, maxTriangleLengthP As Double) As Long
    Public Declare Function scadSDK_dtmContoursGetLineInfo Lib "SCadSDKAT" (ByVal srf As Long, interval As Double, minorsPerMajor As Long, smoothing As Long, totalLines As Long, maxPoints As Long) As Long
    Public Declare Function scadSDK_dtmContoursGetLines Lib "SCadSDKAT" (ByVal srf As Long, interval As Double, minorsPerMajor As Long, smoothing As Long, maxPoints As Long, dpts As Point3d) As Long
    Public Declare Function scadSDK_dtmContoursIterate Lib "SCadSDKAT" (ByVal srf As Long, interval As Double, minorsPerMajor As Long, smoothing As Long, ByVal pCallBack As Long) As Long
    Public Declare Function scadSDK_dtmDrapeLineStringGetCount Lib "SCadSDKAT" (ByVal srf As Long, ByVal inPtNum As Long, inPoints As Point3d, outPtNum As Long) As Long
    Public Declare Function scadSDK_dtmDrapeLineString Lib "SCadSDKAT" (ByVal srf As Long, ByVal inPtNum As Long, inPoints As Point3d, outPtNum As Long, outPoints As Point3d) As Long
    Public Declare Function scadSDK_dtmSurfaceThin Lib "SCadSDKAT" (numBeforeThin As Long, numAfterThin As Long, ByVal srfOut As Long, ByVal srfIn As Long, ByVal heightTol As Double, ByVal minDistanceTol As Double, ByVal maxDistanceTol As Double, ByVal copyInfBreaklines As Long) As Long
    Public Declare Function scadSDK_dtmSurfacePerimeterGetCount Lib "SCadSDKAT" (ByVal srf As Long, numPoints As Long) As Long
    Public Declare Function scadSDK_dtmSurfacePerimeter Lib "SCadSDKAT" (ByVal srf As Long, numPoints As Long, vrtArray As Point3d) As Long
    
    ' Point Functions
    Public Declare Function scadSDK_dtmPointsInitialize Lib "SCadSDKAT" (ByVal srf As Long) As Long
    Public Declare Function scadSDK_dtmPointsUninitialize Lib "SCadSDKAT" () As Long
    Public Declare Function scadSDK_dtmPointsGetIndex Lib "SCadSDKAT" (ByVal pnt As Long, index As Long) As Long
    Public Declare Function scadSDK_dtmPointsGetPoint Lib "SCadSDKAT" (ByVal index As Long, pnt As Long) As Long
    Public Declare Function scadSDK_dtmPointsGetInfo Lib "SCadSDKAT" (ByVal pnt As Long, X As Double, y As Double, z As Double) As Long
    
    ' Triangle Functions
    Public Declare Function scadSDK_dtmFindTriangle Lib "SCadSDKAT" (ByVal srf As Long, pnt As Point3d, triangle As Point3d) As Long
    Public Declare Function scadSDK_dtmTrianglesFind Lib "SCadSDKAT" (ByVal srf As Long, pnt As Point3d, triangle As Long) As Long
    Public Declare Function scadSDK_dtmTrianglesGetArea Lib "SCadSDKAT" (ByVal triangle As Long, trueArea As Double, planarArea As Double) As Long
    Public Declare Function scadSDK_dtmTrianglesGetAspect Lib "SCadSDKAT" (ByVal triangle As Long, aspect As Double) As Long
    Public Declare Function scadSDK_dtmTrianglesGetCoordinates Lib "SCadSDKAT" (ByVal triangle As Long, coords As Point3d) As Long
    Public Declare Function scadSDK_dtmTrianglesGetFirst Lib "SCadSDKAT" (triangle As Long) As Long
    Public Declare Function scadSDK_dtmTrianglesGetLast Lib "SCadSDKAT" (triangle As Long) As Long
    Public Declare Function scadSDK_dtmTrianglesGetNeighbors Lib "SCadSDKAT" (ByVal triangle As Long, triangle1 As Long, triangle2 As Long, triangle3 As Long) As Long
    Public Declare Function scadSDK_dtmTrianglesGetNext Lib "SCadSDKAT" (triangle As Long) As Long
    Public Declare Function scadSDK_dtmTrianglesGetPoints Lib "SCadSDKAT" (ByVal triangle As Long, p1 As Long, p2 As Long, p3 As Long) As Long
    Public Declare Function scadSDK_dtmTrianglesGetPrevious Lib "SCadSDKAT" (triangle As Long) As Long
    Public Declare Function scadSDK_dtmTrianglesGetSlope Lib "SCadSDKAT" (ByVal triangle As Long, slope As Double) As Long
    Public Declare Function scadSDK_dtmTrianglesInitialize Lib "SCadSDKAT" (ByVal srf As Long, triangle As Long) As Long
    Public Declare Function scadSDK_dtmTrianglesSetIndex Lib "SCadSDKAT" (ByVal location As Long, triangle As Long) As Long
    
    ' Surface Creation Functions
    Public Declare Function scadSDK_dtmSurfaceCreate Lib "SCadSDKAT" (srf As Long, ByVal Name As Long, ByVal desc As Long, ByVal file As Long, ByVal mat As Long, ByVal maxTriLength As Double, ByVal scl As Double) As Long
    Public Declare Function scadSDK_dtmSurfaceDelete Lib "SCadSDKAT" (ByVal srf As Long, ByVal emptyOnly As Long) As Long
    Public Declare Function scadSDK_dtmSurfaceDeleteByName Lib "SCadSDKAT" (ByVal srfName As Long, ByVal emptyOnly As Long) As Long
    
    ' Surface IO Functions
    Public Declare Function scadSDK_dtmSurfaceLoad Lib "SCadSDKAT" (srf As Long, fileWasTTN As Long, ByVal FileName As Long) As Long
    Public Declare Function scadSDK_dtmSurfaceSave Lib "SCadSDKAT" (ByVal srf As Long, ByVal FileName As Long) As Long
    Public Declare Function scadSDK_dtmSurfaceToLandXML Lib "SCadSDKAT" (ByVal dtmFileName As Long, ByVal landXMLFileName As Long) As Long
    Public Declare Function scadSDK_dtmSurfaceCopy Lib "SCadSDKAT" (ByVal srfOrgP As Long, srvNewPP As Long, ByVal Name As Long, ByVal desc As Long, ByVal style As Long, ByVal nOverwriteExisting As Long) As Long
    
    
    

    SCadCOGO.TXT

    ' -----------------------------------------------------------------------------
    '
    ' Copyright (2001) Bentley Systems, Inc., All rights reserved.
    '
    ' MicroStation, InRoads, InRail and MDL are registered trademarks and "MicroCSL"
    ' is a trademark of Bentley Systems, Inc.
    '
    '
    ' Limited permission is hereby granted to reproduce and modify this
    ' copyrighted material provided that the resulting code is used only
    ' in conjunction with Bentley Systems products under the terms of the
    ' license agreement provided therein, and that this notice is retained
    ' in its entirety in any such reproduction or modification.
    '
    ' -----------------------------------------------------------------------------
    '
    ' SCadCogo.TXT -- InRoads Geometry API Declarations for Visual BAsic
    '
    ' This file contains only the Const, Type,
    ' and Public Declare statements for  InRoads Geometry APIs.
    '
    ' -----------------------------------------------------------------------------
    
    '**************************
    '   CONSTANT Declarations
    '**************************
    
    ' Alignment Types
    Public Const IGNORE = &H0
    Public Const ALG_PROJECT = &H1
    Public Const ALG_COGO = &H2
    Public Const ALG_HORIZONTAL = &H4
    Public Const ALG_VERTICAL = &H8
    Public Const ALG_EQUATION = &H10
    Public Const ALG_H_EVENT = &H20
    Public Const ALG_V_EVENT = &H40
    Public Const ALG_SUPER = &H80
    Public Const ALG_TURNOUT = &H400
    Public Const ALG_TURNOUT_POINTS = &H1000
    
    ' Element Types
    Public Const ELE_NOMASK = &H80000000
    Public Const H_ELE_LINE = &H1
    Public Const H_ELE_CIRCLE = &H2
    Public Const H_ELE_SPIRAL = &H4
    Public Const V_ELE_LINE = &H8
    Public Const V_ELE_CIRCLE = &H10
    Public Const V_ELE_PARABOLA = &H20
    Public Const H_EVENT_POINT_STN = &H40
    Public Const H_EVENT_POINT_XY = &H80
    Public Const V_EVENT_POINT = &H100
    Public Const H_COGO_POINT = &H200
    Public Const G_EQUATION_POINT = &H400
    Public Const H_SUP_APPSTNV1 = &H800
    Public Const CANT_POINT = &H2000
    Public Const H_REGRESSION_POINT = &H2000000
    Public Const V_REGRESSION_POINT = &H4000000
    
    ' Spiral Types
    Public Const H_ELE_SPIRAL_CLOTHOID = &H1
    Public Const H_ELE_SPIRAL_BLOSS = &H2
    Public Const H_ELE_SPIRAL_HALF_BLOSS = &H4
    Public Const H_ELE_SPIRAL_SINUSOID = &H8
    Public Const H_ELE_SPIRAL_HALF_SINUSOID = &H10
    Public Const H_ELE_SPIRAL_CUBIC = &H20
    Public Const H_ELE_SPIRAL_BIQUADRATIC = &H40
    Public Const H_ELE_SPIRAL_HALF_BIQUADRATIC = &H100
    Public Const H_ELE_SPIRAL_COSINE = &H200
    Public Const H_ELE_SPIRAL_HALF_COSINE = &H400
    
    'Cant Types
    Public Const ALG_LINEAR_CANT = &H0
    Public Const ALG_CLOTHOID_CANT = &H400
    Public Const ALG_BLOSS_CANT = &H800
    Public Const ALG_SINUSOID_CANT = &H1000
    Public Const ALG_CUBIC_CANT = &H2000
    Public Const ALG_BIQUADRATIC_CANT = &H4000
    Public Const ALG_COSINE_CANT = &H10000
    
    'Curvature Cant Types
    Public Const LEFT_CURVATURE = -1
    Public Const RIGHT_CURVATURE = 1
    
    ' Curve Definitions
    Public Const H_CURVE_DEFINITION = 0
    Public Const H_CHORD_DEFINITION = 0
    Public Const H_ARC_DEFINITION = 1
    Public Const V_PARABOLIC_DEFINITION = 0
    Public Const V_CIRCULAR_DEFINITION = 1
    
    ' String Sizes
    Public Const ALGFILSZ = 256
    Public Const ALGNAMSZ = 64
    Public Const ALGDESSZ = 40
    Public Const ALGDSCSZ = 80
    Public Const ALGFTRSZ = 32
    Public Const ALGPNTSZ = 24
    
    ' Return Values
    Public Const ALG_W_NO_SOLUTION = 503
    
    ' Turnout Points
    Public Const POINT_0 = ".0"
    Public Const POINT_1 = ".1"
    Public Const POINT_2 = ".2"
    Public Const POINT_3 = ".3"
    Public Const POINT_4 = ".4"
    Public Const POINT_5 = ".5"
    Public Const POINT_53 = "53"
    Public Const POINT_54 = "54"
    Public Const POINT_61 = ".61"
    Public Const POINT_62 = ".62"
    Public Const THEORETICAL_POINT_1 = "Theoretical .1"
    
    ' Turnout Types
    Public Const TURNOUT_TYPE_SINGLE = 1
    Public Const TURNOUT_TYPE_DOUBLE = 2
    Public Const TURNOUT_TYPE_SINGLE_SLIP = 4
    Public Const TURNOUT_TYPE_DOUBLE_SLIP = 8
    Public Const TURNOUT_TYPE_DIAMOND_CROSSING = 16
    
    ' Turnout Bent Status
    Public Const bent = &H1
    Public Const NOT_BENT = &H2
    Public Const BENT_CONCAVE = &H4
    Public Const BENT_CONVEX = &H8
    Public Const BENT_LINEAR = &H10
    
    
    ' General Purpose
    Public Const INFINITE = 1E+38
    
    Type HorizontalCurveSet
        PI As Point3d
        spiralType1 As Long
        unused1 As Long
        spiralLength1 As Double
        radius As Double
        spiralType2 As Long
        unused2 As Long
        spiralLength2 As Double
        tangentLength1 As Double
        tangentLength2 As Double
    End Type
    
    
    Type VerticalCurveSet
        PI As Point2d
        spiralLength1 As Double
        radius As Double
        spiralLength2 As Double
    End Type
    
    Type CogoPointInfo
        pnt As Point3d
        Name As Long
        desc As Long
        feat As Long
    End Type
    
    Type PVIData
        stn As Double
        elev As Double
        vcl As Double       ' parabola left length
        vcr As Double       ' parabola right length
        rad As Double       ' circle radius
        tan As Double       ' tangent
        type As Integer     ' pvi type - V_ELE_LINE, V_ELE_PARABOLA, V_ELE_CIRCLE
    End Type
    
    Type RegressionPointInfo
        pnt As Point3d
        Name As Long
        desc As Long
        feat As Long
        stn As Double
        offset As Double
    End Type
    
    '**************************
    '   FUNCTION Declarations
    '**************************
    
    ' General functions
    Public Declare Function scadSDK_cogoGetActiveStyle Lib "SCadSDKAT" (ByVal nType As Integer, ByVal style As Long) As Long
    
    ' Project functions
    Public Declare Function scadSDK_cogoGetActiveProject Lib "SCadSDKAT" (prj As Long) As Long
    Public Declare Function scadSDK_cogoSetActiveProject Lib "SCadSDKAT" (ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoCountNumberOfProjects Lib "SCadSDKAT" () As Long
    Public Declare Function scadSDK_cogoGetProjects Lib "SCadSDKAT" (prj As Long, count As Long) As Long
    Public Declare Function scadSDK_cogoProjectInfoGet Lib "SCadSDKAT" (ByVal file As Long, ByVal Name As Long, ByVal desc As Long, ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoLoadGeometryFile Lib "SCadSDKAT" (prj As Long, ByVal FileName As Long) As Long
    Public Declare Function scadSDK_cogoCreateProject Lib "SCadSDKAT" (prj As Long, ByVal Name As Long, ByVal desc As Long) As Long
    Public Declare Function scadSDK_cogoTransformProject Lib "SCadSDKAT" (ByVal prj As Long, ByVal angle As Double, ByVal xTrans As Double, ByVal yTrans As Double, ByVal zTrans As Double, ByVal xScale As Double, ByVal yScale As Double) As Long
    Public Declare Function scadSDK_cogoRemoveProject Lib "SCadSDKAT" (ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoSaveProject Lib "SCadSDKAT" (ByVal FileName As Long, ByVal prj As Long) As Long
    
    
    ' General Alignment routines
    Public Declare Function scadSDK_cogoAlignmentInfoGet Lib "SCadSDKAT" (ByVal Name As Long, ByVal desc As Long, ByVal feat As Long, ByVal pAlg As Long) As Long
    Public Declare Function scadSDK_cogoAlignmentInfoSet Lib "SCadSDKAT" (ByVal Name As Long, ByVal desc As Long, ByVal feat As Long, ByVal pAlg As Long) As Long
    Public Declare Function scadSDK_cogoAlignmentType Lib "SCadSDKAT" (ByVal pAlg As Long) As Long
    Public Declare Function scadSDK_cogoFindElevationByStation Lib "SCadSDKAT" (elevation As Double, ByVal alg As Long, ByVal station As Double) As Long
    Public Declare Function scadSDK_cogoFindFirstStationOnAlignment Lib "SCadSDKAT" (stn As Double, ByVal alg As Long) As Long
    Public Declare Function scadSDK_cogoFindLastStationOnAlignment Lib "SCadSDKAT" (stn As Double, ByVal alg As Long) As Long
    Public Declare Function scadSDK_cogoStationOffsetToXY Lib "SCadSDKAT" (pnt As Point3d, tangentialAzimuth As Double, ByVal halg As Long, ByVal station As Double, ByVal offset As Double) As Long
    Public Declare Function scadSDK_cogoXyToStationOffset Lib "SCadSDKAT" (station As Double, offset As Double, azimuth As Double, ByVal halg As Long, pnt As Point3d) As Long
    Public Declare Function scadSDK_cogoGetCountAlignmentAlignmentIntersect Lib "SCadSDKAT" (ByVal alg1 As Long, offset1 As Double, ByVal alg2 As Long, offset2 As Double) As Long
    Public Declare Function scadSDK_cogoAlignmentAlignmentIntersect Lib "SCadSDKAT" (dpts As Point3d, ByVal alg1 As Long, offset1 As Double, ByVal alg2 As Long, offset2 As Double) As Long
    Public Declare Function scadSDK_cogoGetCountElementElementIntersect Lib "SCadSDKAT" (ByVal ele1 As Long, offset1 As Double, ByVal ele2 As Long, offset2 As Double) As Long
    Public Declare Function scadSDK_cogoElementElementIntersect Lib "SCadSDKAT" (dpts As Point3d, ByVal ele1 As Long, offset1 As Double, ByVal ele2 As Long, offset2 As Double) As Long
    Public Declare Function scadSDK_cogoGetCountElementAlignmentIntersect Lib "SCadSDKAT" (ByVal ele As Long, eleOffset As Double, ByVal alg As Long, algOffset As Double) As Long
    Public Declare Function scadSDK_cogoElementAlignmentIntersect Lib "SCadSDKAT" (dpts As Point3d, ByVal ele As Long, eleOffset As Double, ByVal alg As Long, algOffset As Double) As Long
    Public Declare Function scadSDK_cogoSetIsFiniteIntersection Lib "SCadSDKAT" (flag As Long) As Long
    Public Declare Function scadSDK_cogoIsFiniteIntersection Lib "SCadSDKAT" () As Long
    Public Declare Function scadSDK_cogoInitialize3DStationing Lib "SCadSDKAT" (ByVal alg As Long) As Long
    Public Declare Function scadSDK_cogo2DStationTo3DStation Lib "SCadSDKAT" (ByVal stnIn As Double, stnOut As Double) As Long
    Public Declare Function scadSDK_cogo3DStationTo2DStation Lib "SCadSDKAT" (ByVal stnIn As Double, stnOut As Double) As Long
    Public Declare Function scadSDK_cogoUninitialize3DStationing Lib "SCadSDKAT" () As Long
    Public Declare Function scadSDK_cogoCompute3DStationToXyzEtal Lib "SCadSDKAT" (ByVal halg As Long, ByVal valg As Long, ByVal sAlg As Long, ByVal stn3D As Double, stn2D As Double, pnt As Point3d, tangential As Double, radial As Double, instRadius As Double, beta As Double, instVRadius As Double, alpha As Double, designSpeed As Double) As Long
    Public Declare Function scadSDK_cogoComputeAlignmentArea Lib "SCadSDKAT" (ByVal alg As Long, area As Double) As Long
    Public Declare Function scadSDK_cogoComputeArea Lib "SCadSDKAT" (ByVal npts As Long, pts As Double, area As Double) As Long
    Public Declare Function scadSDK_cogoComputeAlignmentRange Lib "SCadSDKAT" (ByVal alg As Long, minimum As Point3d, maximum As Point3d) As Long
    
    Public Declare Function scadSDK_cogoComputeAlignmentLength Lib "SCadSDKAT" (ByVal alg As Long, length As Double) As Long
    Public Declare Function scadSDK_cogoComputeLength Lib "SCadSDKAT" (ByVal npts As Long, pts As Double, len2D As Double, len3d As Double) As Long
    Public Declare Function scadSDK_cogoComputeCantAtStation Lib "SCadSDKAT" (ByVal alg As Long, ByVal stn As Double, leftRail As Double, rightRail As Double, designSpeed As Double) As Long
    Public Declare Function scadSDK_cogoComputeRadiusAtStation Lib "SCadSDKAT" (ByVal alg As Long, ByVal ele As Long, ByVal station As Double, radius As Double, sign As Double) As Long
    Public Declare Function scadSDK_cogoStationToString Lib "SCadSDKAT" (ByVal alg As Long, ByVal station As Double, ByVal format As Long, ByVal decimals As Long, ByVal stationString As Long) As Long
    Public Declare Function scadSDK_cogoStringToStation Lib "SCadSDKAT" (ByVal alg As Long, station As Double, ByVal stationString As Long) As Long
    Public Declare Function scadSDK_cogoDoubleToString Lib "SCadSDKAT" (ByVal doubleValue As Double, ByVal doubleType As Long, ByVal doubleString As Long) As Long
    Public Declare Function scadSDK_cogoStringToDouble Lib "SCadSDKAT" (doubleValue As Double, ByVal doubleType As Long, ByVal doubleString As Long) As Long
    Public Declare Function scadSDK_cogoGetStationType Lib "SCadSDKAT" (ByVal alg As Long, ByVal station As Double, ByVal stationType As Long) As Long
    Public Declare Function scadSDK_cogoOffsetAlignment Lib "SCadSDKAT" (ByVal newAlg As Long, ByVal originalAlg As Long, offset As Double) As Long
    Public Declare Function scadSDK_cogoAlignmentTranspose Lib "SCadSDKAT" (ByVal pAlg As Long) As Long
    Public Declare Function scadSDK_cogoFixDiscontinuities Lib "SCadSDKAT" (ByVal pAlg As Long) As Long
    
    ' Horizontal Alignment routines
    Public Declare Function scadSDK_cogoGetActiveHorizontalAlignment Lib "SCadSDKAT" (halg As Long, ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoSetActiveHorizontalAlignment Lib "SCadSDKAT" (ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoCountNumberOfHorizontals Lib "SCadSDKAT" (ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoGetHorizontalAlignments Lib "SCadSDKAT" (halg As Long, count As Long, ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoFindHorizontalAlignmentByName Lib "SCadSDKAT" (halg As Long, ByVal prj As Long, ByVal Name As Long) As Long
    Public Declare Function scadSDK_cogoFindFirstPointOnHorizontalAlignment Lib "SCadSDKAT" (pnt As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoFindLastPointOnHorizontalAlignment Lib "SCadSDKAT" (pnt As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoSetInitialStationing Lib "SCadSDKAT" (ByVal halg As Long, ByVal delta As Double) As Long
    Public Declare Function scadSDK_cogoTransformHorizontalAlignment Lib "SCadSDKAT" (ByVal prj As Long, ByVal halg As Long, ByVal angle As Double, ByVal xTrans As Double, ByVal yTrans As Double, ByVal zTrans As Double, ByVal xScale As Double, ByVal zScale As Double) As Long
    Public Declare Function scadSDK_cogoFindClosestHorizontalAlignment Lib "SCadSDKAT" (halg As Long, ByVal prj As Long, pnt As Point3d) As Long
    Public Declare Function scadSDK_cogoCreateHorizontalAlignment Lib "SCadSDKAT" (halg As Long, ByVal Name As Long, ByVal desc As Long, ByVal feat As Long) As Long
    Public Declare Function scadSDK_cogoRemoveHorizontalAlignment Lib "SCadSDKAT" (ByVal prj As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoHorizontalAlignmentFromCurveSets Lib "SCadSDKAT" (ByVal halg As Long, curveSet As HorizontalCurveSet, ByVal cnt As Long) As Long
    Public Declare Function scadSDK_cogoHorizontalAlignmentGetCurveType Lib "SCadSDKAT" (ByVal halg As Long, curveType As Long) As Long
    
    ' Vertical Alignment routines
    Public Declare Function scadSDK_cogoGetActiveVerticalAlignment Lib "SCadSDKAT" (valg As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoSetActiveVerticalAlignment Lib "SCadSDKAT" (ByVal valg As Long) As Long
    Public Declare Function scadSDK_cogoCountNumberOfVerticals Lib "SCadSDKAT" (ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoGetVerticalAlignments Lib "SCadSDKAT" (valg As Long, count As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoFindVerticalAlignmentByName Lib "SCadSDKAT" (valg As Long, ByVal halg As Long, ByVal Name As Long) As Long
    Public Declare Function scadSDK_cogoFindFirstPointOnVerticalAlignment Lib "SCadSDKAT" (pnt As Long, ByVal valg As Long) As Long
    Public Declare Function scadSDK_cogoFindLastPointOnVerticalAlignment Lib "SCadSDKAT" (pnt As Long, ByVal valg As Long) As Long
    Public Declare Function scadSDK_cogoTransformVerticalAlignment Lib "SCadSDKAT" (ByVal alg As Long, ByVal xTrans As Double, ByVal yTrans As Double, ByVal xScale As Double, ByVal yScale As Double) As Long
    Public Declare Function scadSDK_cogoCreateVerticalAlignment Lib "SCadSDKAT" (valg As Long, ByVal Name As Long, ByVal desc As Long, ByVal feat As Long) As Long
    Public Declare Function scadSDK_cogoRemoveVerticalAlignment Lib "SCadSDKAT" (ByVal prj As Long, ByVal valg As Long) As Long
    Public Declare Function scadSDK_cogoVerticalAlignmentFromPVI Lib "SCadSDKAT" (valg As Long, pvis As Long, ByVal nPvis As Long) As Long
    Public Declare Function scadSDK_cogoVerticalAlignmentFromCurveSets Lib "SCadSDKAT" (ByVal valg As Long, curveSet As VerticalCurveSet, ByVal cnt As Long) As Long
    Public Declare Function scadSDK_cogoInsertVerticalAlignment Lib "SCadSDKAT" (ByVal halg As Long, ByVal valg As Long) As Long
    Public Declare Function scadSDK_cogoVerticalAlignmentGetCurveType Lib "SCadSDKAT" (ByVal valg As Long, curveType As Long) As Long
    
    'Super Elevation routines
    Public Declare Function scadSDK_cogoGetActiveSuperAlignment Lib "SCadSDKAT" (super As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoSetActiveSuperAlignment Lib "SCadSDKAT" (ByVal sAlg As Long) As Long
    Public Declare Function scadSDK_cogoCountNumberOfSuperelevations Lib "SCadSDKAT" (ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoGetSuperAlignments Lib "SCadSDKAT" (sAlg As Long, count As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoRemoveSuperAlignment Lib "SCadSDKAT" (ByVal prj As Long, ByVal sAlg As Long) As Long
    Public Declare Function scadSDK_cogoCreateSuperAlignment Lib "SCadSDKAT" (ByVal halg As Long, ByVal sAlg As Long, ByVal rateTable As Long, ByVal speedTable As Long) As Long
    
    'Cant Alignment rountines
    Public Declare Function scadSDK_cogoAddCantStation Lib "SCadSDKAT" (ByRef ele As Long, ByVal halg As Long, ByVal cAlg As Long, ByVal station As Double, ByVal cant As Double, ByVal designSpeed As Double, ByVal transition As Long, ByVal curvature As Long) As Long
    Public Declare Function scadSDK_cogoAddSpeedChangeOnly Lib "SCadSDKAT" (ByRef ele As Long, ByVal halg As Long, ByVal cAlg As Long, ByVal station As Double, ByVal designSpeed As Double) As Long
    Public Declare Function scadSDK_cogoCreateCantAlignment Lib "SCadSDKAT" (sAlg As Long, ByVal Name As Long, ByVal Description As Long) As Long
    
    ' Cogo Point Buffer routines
    Public Declare Function scadSDK_cogoGetActiveCogoAlignment Lib "SCadSDKAT" (cAlg As Long, ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoCogoPointGetInfo Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, X As Double, y As Double, z As Double, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoAddCogoPoint Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, ByVal pPnt As Long) As Long
    Public Declare Function scadSDK_cogoAddCogoPoints Lib "SCadSDKAT" (ByVal pPnts As CogoPointInfo, nPnts As Long, ByVal prj As Long) As Long
    
    ' Horizontal Event Buffer routines
    Public Declare Function scadSDK_cogoGetActiveHorizontalEventBuffer Lib "SCadSDKAT" (hBuf As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoHorizontalEventPointGetInfo Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, X As Double, y As Double, z As Double, stn As Double, offset As Double, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoAddHorizontalEventPointFromStationOffset Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, ByVal stn As Double, ByVal offset As Double, ByVal halg As Long, ByVal pntType As Long) As Long
    Public Declare Function scadSDK_cogoAddHorizontalEventPointFromXY Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, ByVal X As Double, ByVal y As Double, ByVal z As Double, ByVal halg As Long, ByVal pntType As Long) As Long
    
    ' Horizontal Regression functions
    Public Declare Function scadSDK_cogoHorizontalRegressionPointGetInfo Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, X As Double, y As Double, z As Double, stn As Double, offset As Double, fixedOff As Double, weight As Double, status As Long, status2 As Long, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoAddHorizontalRegressionPoint Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, ByVal X As Double, ByVal y As Double, ByVal z As Double, ByVal stn As Double, ByVal offset As Double, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoAddHorizontalRegressionPoints Lib "SCadSDKAT" (ByVal pPnts As RegressionPointInfo, nPnts As Long, ByVal halg As Long) As Long
    
    ' Vertical Event Buffer routines
    Public Declare Function scadSDK_cogoGetActiveVerticalEventBuffer Lib "SCadSDKAT" (vBuf As Long, ByVal valg As Long) As Long
    Public Declare Function scadSDK_cogoVerticalEventPointGetInfo Lib "SCadSDKAT" (ByVal feat As Long, ByVal desc As Long, stn As Double, elev As Double, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoAddVerticalEventPoint Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, ByVal stn As Double, ByVal elev As Double, ByVal valg As Long) As Long
    
    ' Vertical Regression functions
    Public Declare Function scadSDK_cogoVerticalRegressionPointGetInfo Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, stn As Double, elev As Double, fixedOff As Double, weight As Double, status As Long, status2 As Long, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoAddVerticalRegressionPoint Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, ByVal desc As Long, ByVal stn As Double, ByVal elev As Double, ByVal valg As Long) As Long
    
    ' Station Equation routines
    Public Declare Function scadSDK_cogoGetActiveStationEquationBuffer Lib "SCadSDKAT" (seAlg As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoStationEquationGetInfo Lib "SCadSDKAT" (ByVal bckEqn As Long, ByVal ahdEqn As Long, stn As Double, bck As Double, ahd As Double, X As Double, y As Double, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoInsertStationEquation Lib "SCadSDKAT" (ByVal bckEqn As Long, ByVal ahdEqn As Long, ByVal stn As Double, ByVal bck As Double, ByVal ahd As Double, ByVal X As Double, ByVal y As Double, ByVal halg As Long) As Long
    
    ' Turnout routines
    Public Declare Function scadSDK_cogoGetActiveTurnoutAlignment Lib "SCadSDKAT" (tAlg As Long, ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoCountNumberOfTurnouts Lib "SCadSDKAT" (ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoGetTurnoutAlignments Lib "SCadSDKAT" (tAlgs As Long, cnt As Long, ByVal prj As Long) As Long
    Public Declare Function scadSDK_cogoGetTurnoutPoint Lib "SCadSDKAT" (tPnt As Long, ByVal tAlg As Long, ByVal heel As Long, ByVal pointName As Long) As Long
    Public Declare Function scadSDK_cogoTransformTurnout Lib "SCadSDKAT" (ByVal tAlg As Long, ByVal angle As Double, ByVal xTrans As Double, ByVal yTrans As Double, ByVal zTrans As Double, ByVal xScale As Double, ByVal yScale As Double) As Long
    Public Declare Function scadSDK_cogoRemoveTurnoutAlignment Lib "SCadSDKAT" (ByVal prj As Long, ByVal tAlg As Long) As Long
    Public Declare Function scadSDK_cogoGetTurnoutMainLineExtents Lib "SCadSDKAT" (ByVal prj As Long, ByVal tAlg As Long, halg As Long, first As Long, last As Long, forward As Long) As Long
    Public Declare Function scadSDK_cogoGetTurnoutType Lib "SCadSDKAT" (ByVal tAlg As Long, toType As Long)
    Public Declare Function scadSDK_cogoIsTurnoutBent Lib "SCadSDKAT" (ByVal tAlg As Long, bent As Long)
    
    ' General Element routines
    Public Declare Function scadSDK_cogoCountNumberOfElements Lib "SCadSDKAT" (ByVal alg As Long) As Long
    Public Declare Function scadSDK_cogoElementType Lib "SCadSDKAT" (ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoElementFirst Lib "SCadSDKAT" (ByVal alg As Long) As Long
    Public Declare Function scadSDK_cogoElementLAst Lib "SCadSDKAT" (ByVal alg As Long) As Long
    Public Declare Function scadSDK_cogoElementNext Lib "SCadSDKAT" (ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoElementPrevious Lib "SCadSDKAT" (ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoElementByIndex Lib "SCadSDKAT" (ByVal alg As Long, ByVal index As Long) As Long
    Public Declare Function scadSDK_cogoDeleteElement Lib "SCadSDKAT" (ByVal ele As Long, ByVal alg As Long) As Long
    Public Declare Function scadSDK_cogoFindClosestElementByStation Lib "SCadSDKAT" (ele As Long, ByVal alg As Long, stn As Double) As Long
    Public Declare Function scadSDK_cogoNumberOfStrokes Lib "SCadSDKAT" (ByVal chordHeightTolerance As Double, ByVal ele As Long, numStrokes As Long) As Long
    Public Declare Function scadSDK_cogoStrokeElement Lib "SCadSDKAT" (vertices As Double, ByVal ele As Long, ByVal numStrokes As Long) As Long
    Public Declare Function scadSDK_cogoStrokeHorizontalElement Lib "SCadSDKAT" (vertices As Point3d, ByVal ele As Long, ByVal numStrokes As Long) As Long
    Public Declare Function scadSDK_cogoStrokeVerticalElement Lib "SCadSDKAT" (vertices As Point2d, ByVal ele As Long, ByVal numStrokes As Long) As Long
    Public Declare Function scadSDK_cogoGetElementDirections Lib "SCadSDKAT" (ByVal ele As Long, enterDir As Double, exitDir As Double, chordDir As Double) As Long
    
    ' Horizontal Element routines
    Public Declare Function scadSDK_cogoHorizontalElementGetEndPoints Lib "SCadSDKAT" (startPt As Long, endPt As Long, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoHorizontalCircleGetInfo Lib "SCadSDKAT" (pc As Long, cc As Long, pt As Long, delta As Double, radius As Double, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoHorizontalCircleGetExtendedInfo Lib "SCadSDKAT" (pc As Long, cc As Long, pt As Long, PI As Point2d, ByVal feat As Long, delta As Double, radius As Double, arcLength As Double, degreeOfCurvature As Double, chordLength As Double, tangentLength As Double, middleOrdinate As Double, external As Double, segmentArea As Double, sectorArea As Double, ByVal chordDefinition As Long, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoHorizontalSpiralGetInfo Lib "SCadSDKAT" (bs As Long, PI As Long, es As Long, length As Double, a As Double, entranceRadius As Double, exitRadius As Double, subType As Long, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoHorizontalSpiralGetExtendedInfo Lib "SCadSDKAT" (bs As Long, PI As Long, es As Long, ByVal feat As Long, entranceRadius As Double, exitRadius As Double, length As Double, theta As Double, ks As Double, p As Double, ys As Double, xs As Double, longChordLength As Double, shortTangentLength As Double, longTangentLength As Double, a As Double, subType As Long, method As Long, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoHorizontalCountNumberOfCurveSets Lib "SCadSDKAT" (count As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoHorizontalCurveSetGetInfo Lib "SCadSDKAT" (first As Long, last As Long, PI As Long, delta As Double, ts1 As Double, ts2 As Double, ext As Double, superRate As Double, curveSetIndex As Long, ByVal halg As Long) As Long
    Public Declare Function scadSDK_cogoFindClosestHorizontalElement Lib "SCadSDKAT" (ele As Long, ByVal halg As Long, pnt As Point3d) As Long
    Public Declare Function scadSDK_cogoAddHorizontalLineByDirectionNLength Lib "SCadSDKAT" (ele As Long, ByVal halg As Long, point As Point3d, ByVal azimuth As Double, ByVal length As Double) As Long
    Public Declare Function scadSDK_cogoAddHorizontalLineByPoints Lib "SCadSDKAT" (ele As Long, ByVal halg As Long, point1 As Point3d, point2 As Point3d) As Long
    Public Declare Function scadSDK_cogoAddHorizontalCircularByPointsOnArc Lib "SCadSDKAT" (ele As Long, ByVal halg As Long, point1 As Point3d, point2 As Point3d, point3 As Point3d) As Long
    Public Declare Function scadSDK_cogoAddHorizontalCircularByTwoPointsAndRadius Lib "SCadSDKAT" (ele As Long, ByVal halg As Long, point1 As Point3d, point2 As Point3d, ByVal radius As Double, ByVal longSolution As Long) As Long
    Public Declare Function scadSDK_cogoAddHorizontalCircularByLengthRadius Lib "SCadSDKAT" (ele As Long, ByVal halg As Long, point As Point3d, ByVal az As Double, ByVal length As Double, ByVal radius As Double) As Long
    Public Declare Function scadSDK_cogoAddHorizontalSpiralByLengthRadii Lib "SCadSDKAT" (ele As Long, ByVal halg As Long, point As Point3d, ByVal az As Double, ByVal length As Double, ByVal entr As Double, ByVal extr As Double, ByVal subType As Long) As Long
    Public Declare Function scadSDK_cogoAddHorizontalSpiralByTwoPointsLengthRadii Lib "SCadSDKAT" (ele As Long, ByVal halg As Long, point1 As Point3d, point2 As Point3d, ByVal length As Double, ByVal entr As Double, ByVal extr As Double, ByVal subType As Long) As Long
    
    ' Vertical Element routines
    Public Declare Function scadSDK_cogoVerticalElementGetEndPoints Lib "SCadSDKAT" (startPt As Long, endPt As Long, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoVerticalParabolaGetInfo Lib "SCadSDKAT" (pvc As Long, pvi As Long, pvt As Long, length As Double, rate As Double, k As Double, entranceSlope As Double, exitSlope As Double, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoVerticalCircleGetInfo Lib "SCadSDKAT" (pvc As Long, pvi As Long, pvt As Long, radius As Double, ByVal ele As Long) As Long
    Public Declare Function scadSDK_cogoFindClosestVerticalElement Lib "SCadSDKAT" (ele As Long, ByVal valg As Long, pnt As Point3d) As Long
    Public Declare Function scadSDK_cogoAddVerticalLineByDirectionNLength Lib "SCadSDKAT" (ele As Long, ByVal valg As Long, point As Point2d, ByVal slope As Double, ByVal length As Double) As Long
    Public Declare Function scadSDK_cogoAddVerticalLineByPoints Lib "SCadSDKAT" (ele As Long, ByVal valg As Long, point1 As Point2d, point2 As Point2d) As Long
    Public Declare Function scadSDK_cogoAddVerticalParabolaBy1PointK Lib "SCadSDKAT" (ele As Long, ByVal valg As Long, point As Point2d, ByVal slope As Double, ByVal length As Double, ByVal k As Double) As Long
    Public Declare Function scadSDK_cogoAddVerticalParabolaBy2Points Lib "SCadSDKAT" (ele As Long, ByVal valg As Long, point1 As Point2d, ByVal slope1 As Double, point2 As Point2d, ByVal slope2 As Double) As Long
    Public Declare Function scadSDK_cogoAddVerticalParabolaBy3Points Lib "SCadSDKAT" (ele As Long, ByVal valg As Long, point1 As Point2d, point2 As Point2d, point3 As Point2d) As Long
    Public Declare Function scadSDK_cogoAddVerticalCircleByLengthRadius Lib "SCadSDKAT" (ele As Long, ByVal valg As Long, point As Point2d, ByVal slope As Double, ByVal length As Double, ByVal radius As Double) As Long
    Public Declare Function scadSDK_cogoAddVerticalCircleByPoints Lib "SCadSDKAT" (ele As Long, ByVal valg As Long, point1 As Point2d, point2 As Point2d, point3 As Point2d) As Long
    
    ' Horizontal Point functions
    Public Declare Function scadSDK_cogoHorizontalPointGetInfo Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, X As Double, y As Double, z As Double, station As Double, offset As Double, ByVal pnt As Long) As Long
    
    ' Vertical Point functions
    Public Declare Function scadSDK_cogoVerticalPointGetInfo Lib "SCadSDKAT" (ByVal feat As Long, ByVal desc As Long, station As Double, elevation As Double, ByVal pnt As Long) As Long
    
    ' Turnout point functions
    Public Declare Function scadSDK_cogoTurnoutPointGetInfo Lib "SCadSDKAT" (ByVal Name As Long, ByVal feat As Long, X As Double, y As Double, z As Double, az As Double, rb As Double, re As Double, ByVal pnt As Long) As Long

    I have another module that is used to setup the environment variables. Here is the code.

    Option Explicit
    
    Declare Function GetEnvironmentVariable Lib "kernel32" _
        Alias "GetEnvironmentVariableA" ( _
        ByVal lpName As String, _
        ByVal lpBuffer As String, _
        ByVal nSize As Long) As Long
    
    Declare Function SetEnvironmentVariable Lib "kernel32" _
        Alias "SetEnvironmentVariableA" ( _
        ByVal lpName As String, _
        ByVal lpValue As String) As Long
    
    Private Function GetEV(strName As String) As String
        Dim theSize As Long
        Dim strValue As String
    
        theSize = GetEnvironmentVariable(strName, vbNullString, 0)
        GetEV = Space(theSize)
        GetEnvironmentVariable strName, GetEV, theSize
        GetEV = Left(GetEV, theSize - 1)
    End Function
    
    Public Sub AppendToVar(strEnvVarName As String, strSuffix As String)
        Dim strValue As String
        
        strValue = GetEV("PATH")
        strValue = strValue & strSuffix
        SetEnvironmentVariable strEnvVarName, strValue
    End Sub

    I have 5th module for that has the function I call whenever I want to use InRoads vba commands.

    The function I call at the start of my commands is InRoads_Setup

    Option Explicit
    
    Private Function GetEV(strName As String) As String
        Dim theSize As Long
        Dim strValue As String
    
        theSize = GetEnvironmentVariable(strName, vbNullString, 0)
        
        GetEV = Space(theSize)
        GetEnvironmentVariable strName, GetEV, theSize
        GetEV = Left(GetEV, theSize - 1)
    End Function
    
    Private Sub AppendToVar(strEnvVarName As String, strSuffix As String)
        Dim strValue As String
        
        strValue = GetEV("PATH")
    '    Debug.Print strValue
        If InStr(1, strValue, strSuffix, vbTextCompare) = 0 Then
            If Len(strValue) > 0 Then strValue = strValue & ";"
            strValue = strValue & strSuffix
            SetEnvironmentVariable strEnvVarName, strValue
        End If
    End Sub
    
    Public Sub InRoads_Setup()
        AppendToVar "PATH", "C:\Program Files (x86)\Bentley\InRoads Group V8.11\bin\"
        AppendToVar "PATH", "C:\Program Files (x86)\Bentley\InRoads Group V8.11\bin\ustationdlls\"
    End Sub


    The above was just to get started.  Now for the code I have to get profile info.  The routine below gets me the PVI data sta, elev and curve length.

    First I need to get a long variable m_lngAlgFile for the alg file and I also populate a listbox with all the alignment names

    Function AddItemAlignNames(lbox As ListBox) As Boolean
      Dim lngStat As Long
      Dim lngPrj As Long
      
      
      Dim lngNum As Long
      Dim lngAlg As Long
      Dim lngAlgs() As Long
      Dim lngIndex As Long
    
      Dim i As Long
      Dim strMsg As String
      
      Dim sFeat As String
      Dim sName As String
      Dim sDesc As String
      
      AddItemAlignNames = False
      'm_lngAlgFile = 0
      lbox.Clear
      If m_lngAlgFile > 0 Then
      
      
      sName = String(ALGNAMSZ, vbNullChar)
      sDesc = String(ALGDSCSZ, vbNullChar)
      scadSDK_cogoProjectInfoGet lngNum, StrPtr(sName), StrPtr(sDesc), m_lngAlgFile
      
      mActiveAlgName = sName
    '  lblGP.Caption = sName
      
      lngNum = scadSDK_cogoCountNumberOfHorizontals(m_lngAlgFile)
      ReDim lngAlgs(lngNum - 1)
      
      
        lngStat = scadSDK_cogoGetHorizontalAlignments( _
            lngAlgs(0), _
            lngNum, _
            m_lngAlgFile)
        If lngStat = SDK_SUCCESS Then
        
        
      '    lstAlignments.Clear
          For lngIndex = 0 To lngNum - 1
            lngAlg = lngAlgs(lngIndex)
            sName = String(ALGNAMSZ, vbNullChar)
            sDesc = String(ALGDSCSZ, vbNullChar)
            sFeat = String(ALGFTRSZ, vbNullChar)
            scadSDK_cogoAlignmentInfoGet StrPtr(sName), StrPtr(sDesc), StrPtr(sFeat), lngAlg
            lbox.AddItem sName
          Next lngIndex
      
      
      
      
      
          AddItemAlignNames = True
        End If
      End If
      
    End Function

    When I select an alignment name in the listbox I set the long variable for the alignment m_lngAlign

    Function OpenAlignment() As Boolean
      Dim lngStat As Long
      OpenAlignment = False
      If m_lngAlgFile > 0 Then
        lngStat = scadSDK_cogoFindHorizontalAlignmentByName(m_lngAlign, m_lngAlgFile, StrPtr(mAlign))
        If lngStat = SDK_SUCCESS Then
          OpenAlignment = True
          lngStat = scadSDK_cogoFindFirstStationOnAlignment(mBegSta, ByVal m_lngAlign)
          'If lngStat <> SDK_SUCCESS Then GoTo Error_GetStation
          
          lngStat = scadSDK_cogoFindLastStationOnAlignment(mEndSta, ByVal m_lngAlign)
          'If lngStat <> SDK_SUCCESS Then GoTo Error_GetStation
          
        Else
          m_lngAlign = 0
        End If
      Else
        m_lngAlign = 0
      End If
    End Function

    and populate another listbox with the alignments profiles

    Function AddItemProfileNames(lbox As ListBox) As Boolean
      Dim lngStat As Long
      Dim lngPrj As Long
      
      Dim lngCount As Long
       Dim lngVerts() As Long
      Dim lngVert As Long
      Dim lngIndex As Long
      Dim sName As String
      Dim sDesc As String
      Dim sFeat As String
      
      AddItemProfileNames = False
      lbox.Clear
      lngCount = scadSDK_cogoCountNumberOfVerticals(m_lngAlign)
      
      If lngCount > 0 Then
        ReDim lngVerts(lngCount - 1)
        
    '      While i < lngCount
      
        lngStat = scadSDK_cogoGetVerticalAlignments( _
            lngVerts(0), _
            lngCount, _
            m_lngAlign)
        If lngStat = SDK_SUCCESS Then
          For lngIndex = 0 To lngCount - 1
            lngVert = lngVerts(lngIndex)
              
            sName = String(ALGNAMSZ, vbNullChar)
            sDesc = String(ALGDSCSZ, vbNullChar)
            sFeat = String(ALGFTRSZ, vbNullChar)
          
            scadSDK_cogoAlignmentInfoGet StrPtr(sName), StrPtr(sDesc), StrPtr(sFeat), lngVert
            lbox.AddItem sName
              
              
          Next lngIndex
          AddItemProfileNames = True
        End If
    
      End If
      
    End Function

    Then I select a profile, set the long variable for the profile and populate another listbox with the PVI sta, elev, and curve length.

    Function AddItemProfileGeomRaw(lbox As ListBox) As Boolean
      AddItemProfileGeomRaw = False
      lbox.Clear
      
      Dim lngStat As Long
      Dim lngAlgFileNo As Long
      Dim lngHAlg As Long
      Dim lngVAlg As Long
      Dim strMsg As String
      Dim lngCount As Long
      Dim strVAlgName As String
      
      Dim i As Integer
      Dim lngType As Long
      Dim lngElement As Long
      Dim lngPt1 As Long
      Dim lngPt2 As Long
      Dim lngPtCc As Long
      Dim lngFeat As Long
      Dim lngDesc As Long
      
      Dim dLen As Double
      Dim dK As Double
      Dim dRate As Double
      Dim dEntranceSlope As Double
      Dim dExitSlope As Double
      
      Dim lngPvi As Long
      Dim lngPvt As Long
      Dim lngPvc As Long
      Dim dElevPvi As Double
      Dim dElevPvc As Double
      Dim dElevPvt As Double
      Dim dStaPvi As Double
      Dim dStaPvc As Double
      Dim dStaPvt As Double
      
      strVAlgName = Me.ProfileName
      
      If strVAlgName = "" Then
        Exit Function
      End If
     
        
      lngHAlg = m_lngAlign
    
      lngStat = scadSDK_cogoFindVerticalAlignmentByName(lngVAlg, lngHAlg, StrPtr(strVAlgName))
      If lngStat <> SDK_SUCCESS Then GoTo Error_FindingHAlg
    
      
      Dim bPrevTangent As Boolean
      Dim bNoPrec As Boolean
      
      bPrevTangent = True
      bNoPrec = True
      
      lngCount = scadSDK_cogoCountNumberOfElements(lngVAlg)
      If lngCount < 1 Then GoTo Error_FindingHAlg
      
      i = 0
      While i < lngCount
        lngElement = scadSDK_cogoElementByIndex(lngVAlg, i)
        lngType = scadSDK_cogoElementType(lngElement)
    
    '''    Public Const V_ELE_LINE = &H8
    '''    Public Const V_ELE_CIRCLE = &H10
    '''    Public Const V_ELE_PARABOLA = &H20
    
        If lngType = V_ELE_LINE Then
    '      lbox.AddItem "** V_ELE_LINE"
          lngStat = scadSDK_cogoVerticalElementGetEndPoints(lngPt1, lngPt2, ByVal lngElement)
      
          If i = 0 Then
            lngStat = scadSDK_cogoVerticalPointGetInfo(lngFeat, lngDesc, dStaPvi, dElevPvi, ByVal lngPt1)
            lbox.AddItem dStaPvi & "  " & dElevPvi
          
          ElseIf i = lngCount - 1 Then
            If bPrevTangent = True Then
              lngStat = scadSDK_cogoVerticalPointGetInfo(lngFeat, lngDesc, dStaPvi, dElevPvi, ByVal lngPt1)
              lbox.AddItem dStaPvi & "  " & dElevPvi
            End If
            
            lngStat = scadSDK_cogoVerticalPointGetInfo(lngFeat, lngDesc, dStaPvi, dElevPvi, ByVal lngPt2)
            lbox.AddItem dStaPvi & "  " & dElevPvi
          Else
            If bPrevTangent = True Then
              lngStat = scadSDK_cogoVerticalPointGetInfo(lngFeat, lngDesc, dStaPvi, dElevPvi, ByVal lngPt1)
              lbox.AddItem dStaPvi & "  " & dElevPvi
            End If
          End If
          bPrevTangent = True
    
        ElseIf lngType = V_ELE_PARABOLA Then
          lngStat = scadSDK_cogoVerticalParabolaGetInfo(lngPvc, lngPvi, lngPvt, dLen, dRate, dK, dEntranceSlope, dExitSlope, ByVal lngElement)
          lngStat = scadSDK_cogoVerticalPointGetInfo(lngFeat, lngDesc, dStaPvi, dElevPvi, ByVal lngPvi)
          lngStat = scadSDK_cogoVerticalPointGetInfo(lngFeat, lngDesc, dStaPvc, dElevPvc, ByVal lngPvc)
          lngStat = scadSDK_cogoVerticalPointGetInfo(lngFeat, lngDesc, dStaPvt, dElevPvt, ByVal lngPvt)
          dLen = dStaPvt - dStaPvc
          'lbox.AddItem format(dStaPvi, "0.000000") & "  " & format(dElevPvi, "0.000000") & "  " & format(dLen, "0.000000") & "  " & format(dEntranceSlope * 100, "0.00") & "  " & format(dExitSlope * 100, "0.00")
          
          ' add pvc if curve first element
          If i = 0 Then
            lbox.AddItem dStaPvc & "  " & dElevPvc
          End If
          
          ' add pvi for curve
          lbox.AddItem dStaPvi & "  " & dElevPvi & "  " & dLen
          
          ' add pvt if curve is last element
          If i = lngCount - 1 Then
            lbox.AddItem dStaPvt & "  " & dElevPvt
          End If
          
          
          bPrevTangent = False
        End If
    
        i = i + 1
      Wend
      
    '  scadSDK_cogoVerticalElementGetEndPoints(startPt As Long, endPt As Long, ByVal ele As Long) As Long
    '  scadSDK_cogoVerticalParabolaGetInfo(pvc As Long, pvi As Long, pvt As Long, length As Double, rate As Double, k As Double, entranceSlope As Double, exitSlope As Double, ByVal ele As Long) As Long
    '  scadSDK_cogoVerticalPointGetInfo Lib "SCadSDKAT" (ByVal feat As Long, ByVal desc As Long, station As Double, elevation As Double, ByVal pnt As Long) As Long
    
      
      
      
    Exit_Sub:
    '    lngStat = scadSDK_cogoRemoveProject(lngAlgFileNo)
        Exit Function
      
      
    Error_FindingHAlg:
        MsgBox "Error finding horizontal alignment!", vbCritical
        GoTo Exit_Sub
         
    Error_LoadAlgFile:
        strMsg = "Error " & Err.Number & ", " & Err.Description
        MsgBox strMsg, vbCritical, "LoadAlgFile"
        GoTo Exit_Sub
    
    End Function

    From there I have commands to copy profile data to the clipboard so I can paste it into a spreadsheet.  Here is a pic of my dialog box.

    Quite a bit of code.  Had some help from a co-worker 10 years ago that got me going.

    Regards,

    Andrew

Children
No Data