Results 1 to 2 of 2

Thread: .txt file read for acad polyline conversion

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2024
    Posts
    1

    .txt file read for acad polyline conversion

    i have this .txt file attached.
    I need to read data from it, line by line, these ones

    Br-1 40.000 PF 1 -8.37 8.37 435.04
    Br-1 35.000 PF 1 -8.32 8.32 435.00
    Br-1 34.043 PF 1 -8.31 8.31 434.98
    Br-1 20.016 Bridge
    Br-1 5.990 PF 1 -8.35 8.35 434.87
    Br-1 5.000 PF 1 -8.34 8.34 434.86
    Br-1 0.000 PF 1 -8.30 8.30 434.81

    and create a polyline in acad from them.
    The main question for me is how do i read these lines one by one and store to variables.
    For example i need a "length" variable for the second column, a "leftoffset" variable for 4th column, a "rightoffset" for 5th column and "elevation" for 6th column.
    If you can give a hint please. I am just starting programming and i am confused little bit . So any idea can help me.
    Attached Files Attached Files

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,464

    Re: .txt file read for acad polyline conversion

    You could use a TextFieldParser. The documentation for that class has a code example.

    You could also just do something like this:
    Code:
    For Each line In IO.File.ReadLines(filePath)
        Dim fields = line.Split(" "c)
    
        'Use fields here.
    Next

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width