converting text file data from string to X,Y,Z coordinates
-
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();
-
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();
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.
-
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.
can you explain a little more as i am new to coding, can you five a little example
-
can you explain a little more as i am new to coding, can you five a little example
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."