Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. converting text file data from string to X,Y,Z coordinates

converting text file data from string to X,Y,Z coordinates

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpvisual-studio
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sher Shah 1
    wrote on last edited by
    #1

    Hello experienced people!! I want to convert a data from text file to IList of X,Y,Z coordinates. Actually i need to create topography in Autodesk Revit which needs Ilist of X,Y,Z coordinates. the text file which i am having i can manually directly feed into Revit and create topography as its X,Y,Z Coordinates. But using by c# coding in visual studio i need to convert it to Ilist of X,Y,Z coordinates to be ready as an input. Below is the text of my text file which is X,Y,Z separated by commas 609608.949,5641208.924,309 609609.283,5641208.227,309 609609.793,5641207.702,309 609610.469,5641206.828,309 609610.809,5641206.479,309 609611.318,5641205.954,309 609611.821,5641205.083,309 609612.496,5641204.212,309 609612.996,5641203.342,309 609613.664,5641202.299,309 609613.991,5641201.433,309 609614.149,5641200.741,309 609614.476,5641199.875,309 609614.637,5641199.357,309 609614.963,5641198.492,309 609615.115,5641197.630,309 609615.440,5641196.767,309 609615.596,5641196.077,309 609616.251,5641194.697,308.983 609616.407,5641194.008,308.977 609616.723,5641192.805,308.965 609617.043,5641191.946,308.952 609617.198,5641191.432,308.947 609617.508,5641190.232,308.935 609617.658,5641189.376,308.929 609617.812,5641188.691,308.923 Also i used this code line to access all lines of this text file as strings List lines = File.ReadAllLines(@"D:\My.txt").ToList();

    P 1 Reply Last reply
    0
    • S Sher Shah 1

      Hello experienced people!! I want to convert a data from text file to IList of X,Y,Z coordinates. Actually i need to create topography in Autodesk Revit which needs Ilist of X,Y,Z coordinates. the text file which i am having i can manually directly feed into Revit and create topography as its X,Y,Z Coordinates. But using by c# coding in visual studio i need to convert it to Ilist of X,Y,Z coordinates to be ready as an input. Below is the text of my text file which is X,Y,Z separated by commas 609608.949,5641208.924,309 609609.283,5641208.227,309 609609.793,5641207.702,309 609610.469,5641206.828,309 609610.809,5641206.479,309 609611.318,5641205.954,309 609611.821,5641205.083,309 609612.496,5641204.212,309 609612.996,5641203.342,309 609613.664,5641202.299,309 609613.991,5641201.433,309 609614.149,5641200.741,309 609614.476,5641199.875,309 609614.637,5641199.357,309 609614.963,5641198.492,309 609615.115,5641197.630,309 609615.440,5641196.767,309 609615.596,5641196.077,309 609616.251,5641194.697,308.983 609616.407,5641194.008,308.977 609616.723,5641192.805,308.965 609617.043,5641191.946,308.952 609617.198,5641191.432,308.947 609617.508,5641190.232,308.935 609617.658,5641189.376,308.929 609617.812,5641188.691,308.923 Also i used this code line to access all lines of this text file as strings List lines = File.ReadAllLines(@"D:\My.txt").ToList();

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      The quick and dirty way is to loop over each line, do a string split using the comma and then convert the values from strings. Alternatively, you could use one of the many CSV libraries to read and parse the lines.

      Advanced TypeScript Programming Projects

      S 1 Reply Last reply
      0
      • P Pete OHanlon

        The quick and dirty way is to loop over each line, do a string split using the comma and then convert the values from strings. Alternatively, you could use one of the many CSV libraries to read and parse the lines.

        Advanced TypeScript Programming Projects

        S Offline
        S Offline
        Sher Shah 1
        wrote on last edited by
        #3

        can you explain a little more as i am new to coding, can you five a little example

        P 1 Reply Last reply
        0
        • S Sher Shah 1

          can you explain a little more as i am new to coding, can you five a little example

          P Offline
          P Offline
          phil o
          wrote on last edited by
          #4

          There are several examples of a CSV library here on CP: A Fast CSV Reader[^] Simple and Fast CSV Library in C#[^] There is also a post on SO proposing a few solutions: c# - Reading a CSV file in .NET? - Stack Overflow[^].

          "Five fruits and vegetables a day? What a joke! Personally, after the third watermelon, I'm full."

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups