The CVS Data Format
by Cesar A. Gonzalez Perez


Listing One
'Refer to http://www-gtarpa.usc.es for more information
'open a CVS file.
Dim ly As New Layer
ly.OpenFile "C:\Temp\Test.cvs"

'get the first level.
Dim lv As Level
Set lv = ly.Levels(1)

'iterate all sectors.
Dim lSectorIdx As Long
Dim sc As Sector
For lSectorIdx = 1 To lv.Sectors.Count
    'get sector.
    Set sc = lv.Sectors(lSectorIdx)
    'output data.
    Debug.Print "Sector " & CStr(lSectorIdx) & ":"
    
    'begin retrieving curve data for this sector.
    Dim lCurveCount As Long
    sc.BeginGetData lCurveCount
    
    'iterate all curves in this sector.
    Dim lCurveIdx As Long, lId As Long
    For lCurveIdx = 1 To lCurveCount
        'get curve info.
        Dim lVertexCount As Long
        sc.GetCurveInfo lId, lVertexCount
        'output data.
        Debug.Print "  Curve " & CStr(lId) & " with " 
                            & CStr(lVertexCount) & " vertices:"
        'iterate vertices for this curve.
        Dim lVertexIdx As Long
        For lVertexIdx = 1 To lVertexCount
            'get vertex data.
            Dim dX As Double, dY As Double, dZ As Double
            Dim bInside As Boolean
            sc.GetVertex dX, dY, dZ, bInside
            'output data.
            Debug.Print "    Vertex (" & CStr(dX) & ", " & CStr(dY) & ", 
                                        " & CStr(dZ) & ") " & CStr(bInside)
        Next lVertexIdx
    Next lCurveIdx
    
    'end retrieving curve data.
    sc.EndGetData
Next lSectorIdx

'close CVS file.
ly.CloseFile



1


