[v8i VBA] inroads lib return value

Hi,

On a quest to get some basic information from DTM and ALG files, using the Bentley provided SDK.

Using the function:

Public Declare Function scadSDK_dtmSurfaceInfoGet Lib "SCadSDKAT" ( _
    ByRef name As longString, _
    ByRef desc As longString, _
    ByRef file As longString, _
    ByRef mat As longString, _
    ByRef pref As longString, _
    ByRef secsymb As longString, _
    ByRef prfsymb As longString, _
    maxtrilength As Double, _
    useftrsonlyxsect As Long, _
    useFtrsOnlyPrf As Long, _
    ByVal srf As Long) As Long

I can get name and description into a byte array. Once translated as ASCII, I get the proper readable name and description. (from a loaded DTM surface in inRoads/powercivil/roaddesigner..whatever its called these days. I. dont. care ;)

However, using the similar function (for loaded ALG files)

Public Declare Function scadSDK_cogoAlignmentInfoGet Lib "SCadSDKAT" ( _
    ByRef name As longString, _
    ByRef desc As longString, _
    ByRef feat As Long, _
    ByRef pAlg As Long) As Long

The name and description when translated from a bytearray is total gibberish?

As all the declarations in the provided SDK is byVal and declared as Long, I had to add the byRef and change type to longstring.

Longstring:

Type longString
   s(256) As Byte
End Type

The provided helpfiles says this about the two functions, but there is a mismatch between the descriptions and the SDK examples.

ScadSDK_dtmSurfaceInfoGet

            #include <SCadDTM.h>
            
            int scadSDK_dtmSurfaceInfoGet
            (
                wchar_t *nameP,             // (o) surface's name (or NULL) (size is DTM_C_NAMSIZ)
                wchar_t *descP,             // (o) surface's desc (or NULL) (size is CIV_C_NAMSIZ)
                wchar_t *fileP,             // (o) surface's file (or NULL) (size is CIV_MAX_FNAME)
                wchar_t *matP,              // (o) surface's material (or NULL) (size is CIV_MAX_NAMSIZ)
                wchar_t *prefP,             // (o) surface's preference (or NULL) (size is CIV_C_NAMSIZ)
                wchar_t *secsymbP,          // (o) surface's xsection symb (or NULL) (size is CIV_C_NAMSIZ)
                wchar_t *prfSymbP,          // (o) surface's profile symb (or NULL) (size is CIV_C_NAMSIZ)
                double *maxTriLength,       // (o) max. tri. length (or NULL)
                long *useFtrsOnlyXSect,     // (o) use ftrs only for xsects.(or NULL)
                long *useFtrsOnlyPrf,       // (o) use ftrs only for profiles(or NULL)*/
                struct CIVdtmsrf *srfP      // (i) surface to use
            );
        
Description:  This function returns information about a particular surface.  String parameters must be pre-allocated to predefined sizes.  Setting any of these returns to an initial value of NULL instructs the function to ignore that value.
 
Returns: 

Standard

scadSDK_cogoAlignmentInfoGet

            #include <SCadCogo.h>
            
            int scadSDK_cogoAlignmentInfoGet
            (
                wchar_t *name,      // (o) alignment name (size is ALGNAMSZ)
                wchar_t *desc,      // (o) alignment description (size is ALGDSCSZ)
                wchar_t *style,     // (o) alignment style (size is ALGFTRSZ)
                ALGalign *alg       // (i) pointer to alignment
            );
        
Description:  This function returns information about a particular alignment.  The strings must be large enough to hold the information.  If name, desc or style is set to NULL, it will be ignored and nothing will be returned for that parameter.
 
Returns:  Standard

Any help is appreciated, as all I need for my monster CAD-scanner at this moment is getting the name and description of the ALG files :)

/Torben

Parents Reply Children