Read points from txt file modify some points and output in original order

Trying to figure out how to read in a list of points, modify some of the points and then output points in original order. Reading points in to point cloud modifying all of the points and outputting point cloud keeps point order. Reading in points not into a point cloud, modifying and outputting points loses original point order. Any suggestions on how to do this?

Hi Dwight,

Please post an example of the input you are looking to modify. Thanks

Here is a simple point txt file. I want to read it in and move 4 points and output the file with the points in the same order they were read in.
sphere points.txt (9.5 KB)

This example is a sphere with 185 points I want to move 6 and output all the points in the original order. The excerpt from txt files shows that the original order is lost …

original point txt file modified txt file
1675.242625 16.3843611 -23.82208293 1650.607025 3.0674119 7.361428261
1682.604054 16.3843611 -22.6561472 1646.279999 16.38436127 7.361428261
1681.198146 20.71130019 -22.6561472 1650.607025 29.70131111 7.361428261
1677.517432 23.38549561 -22.6561472 1649.663788 2.382091999 0
1672.967819 23.38549561 -22.6561472 1645.114105 16.38436127 0
1669.287104 20.71130019 -22.6561472 1649.663788 30.38663101 0
1667.881197 16.3843611 -22.6561472 1650.60699 3.067411903 7.361428466
1669.287104 12.05742201 -22.6561472 1646.280051 16.3843611 7.361428466
1672.967819 9.38322659 -22.6561472 1650.60699 29.7013103 7.361428466
1677.517432 9.38322659 -22.6561472 1649.663728 2.382092078 0
1681.198146 12.05742201 -22.6561472 1645.114115 16.3843611 0
1689.244894 16.3843611 -19.27246993 1649.663728 30.38663013 0
1686.570699 24.61468833 -19.27246993 1675.242676 16.38436127 23.82208252
…

There are a number of ways to do this, here we bake the points to Rhino and move them about, then save to new file.

note that it appears each point has a duplicate.

To ensure that you are moving the correct one we could put the Index as its Object Name or as a User Text during the bake process

sphere points.txt (9.5 KB)

added the order to the name for proper selection


OutputPointInOrder-v2.gh (12.3 KB)

double checking the output order

You could also do this in Excel :grin:

1 Like

I was hoping there was something easy in rhino I could do to maintain order versus sorting in excel or programing, typical use involves 20000 points.

I am sorry to say I am completely grasshopper illiterate; can you give me a few clues to get the “program” to work

Google Sheets too…

in Rhino you can start a new file, open grasshopper via the command Grasshopper or by a button, then open the file above. Once open right click on File Path and set it to your file. Mash the Push Content button to get the points in Grasshopper. Right click the last panel (labeled) to set the .txt output & enjoy.

I am using rhino 7

That would require a quick rebuild with a 3rd party plugin. Is this a workflow you are interested in?

Thank you very much! I loaded workflow into rhino 8 and it displays the points to rhino after I point at the right file and do a push, I move some of the points in rhino and somehow do a pull in grasshopper and stream points to my destination. Does just what I want, i’m a little fuzzy on the pull commands but seem to be able to get it to work.

2 Likes