Grasshopper

algorithmic modeling for Rhino

# List Sorting

From below list, where First number of first Row (0) is X coordinate and next number of same row (0) is No of times X coordinate is repeating (here 3 times).
Then next rows  from 1 to 3 (3 steps) are Y, Z coordinate (e.g. y=0,z=49.165 then y=1.331, z=49.213 etc)...like that it is repeating...I want to arrange in X, Y, Z coordinate list.

-317.169,3
0,49.165
1.331,49.213
0,49.213
-317.135,4
0,49.119
1.368,49.167
1.57,49.213
0,49.213
-317.101,4
0,49.072
1.366,49.121
1.776,49.213
0,49.213
-317.068,4
0,49.026
1.364,49.074
1.983,49.213
0,49.213
-317.034,4
0,48.979
1.363,49.028
2.19,49.213
0,49.213
-317,4
0,48.933
1.361,48.981
2.397,49.213
0,49.213
-316.967,4
0,48.887
1.36,48.935
2.603,49.213
0,49.213
-316.933,4
0,48.84
1.358,48.888
2.81,49.213
0,49.213
-316.798,5
0,48.654
1.352,48.702
2.86,49.039
3.204,49.213
0,49.213

Views: 365

Attachments:

Replies are closed for this discussion.

### Replies to This Discussion

I have updated GH file for additional clarification.

You can see there are 3 loops now, these loops may increase as per input data list.

i want to automate it.

My final out put data is x y z coordinate.

Attachments:

Haven't got a clue what you're trying to do?  All numbers, no geometry, not even points?

The list in cube1.txt could be considered X,Y coordinates(?) for 69 points, most of which are duplicates of these thirteen points - is that right?

Yet somehow you end up with 18 points, six of which are duplicates, organized like this (with Z coordinates):

Sorting is easy but I need a much clearer picture of your objective, because just following through your code isn't helpful, esp. since your results are so mysterious, and have duplicate points.

Please note X cord is common for next 6 steps.

Attachments:

No help whatsoever.  No idea what you're trying to do, sorry.

ok...let me explain once again.

Attachments:

No, sorry, I'm not going to bother uploading another spreadsheet to Google docs so I can open it (I don't have Excel).  There must be some way to convey this without a spreadsheet?  Maybe a .csv file?  Attached is from your first version of cube1.xls.

After two cups of coffee, I begin to understand the data...  You have an unfortunate format in the spreadsheet: for each X coord you have six Y coords and two Z coords.  So this isn't about sorting, it's about filling in the blanks in a table that contains 10 sets of six points, each with X, Y and Z coordinates.  Right?

Attachments:

yes,

Source file was cube1.txt, now i have changed to cube1.csv.

see both files i have attached.

Attachments:

There is a very big difference between your version of cube1.csv and mine.  Yours has been processed in a way that loses the original format.  Awkward as it is, that original format is important.  This is the data I want to work with:

Attachments:

Excel which i sent, where i had colored cells and also wrote some additional information like loop 1.., x cord, y cord z cord etc., that excel was just for explaining how to read cube1.txt file.

i am attaching cube1.csv as a source file again.

Attachments:

I used this version of the data, from your first Excel spreadsheet, that I posted as 'cube1.csv'.  I had to do some post-processing (purple group) to get the points into branches, ignore nulls, and remove duplicate points (six points for each loop instead of only the four required? - two duplicates removed).

Good luck.

Attachments:

But process is not as per my expectation. there are 6 steps only.

You could have used cube1.txt file instead of that excel file.

Anyway thanks.

Cube1.txt look like this. Where First Character of first Row is X coordinate and next character of same first row is telling No of times X coordinate is repeating.

Then next rows from 2 to 7 (6 steps)  are Y, Z coordinate...like that it is going.

-3.28,6
1.64,0.
1.64,3.281
-1.64,3.281
-1.64,0.
1.64,0.
1.64,0.
-2.916,6
1.64,0.
1.64,3.281
-1.64,3.281
-1.64,0.
1.64,0.
1.64,0.
-2.551,6
1.64,0.
1.64,3.281
-1.64,3.281
-1.64,0.
1.64,0.
1.64,0.
-2.187,6
1.64,0.
1.64,3.281
-1.64,3.281
-1.64,0.
1.64,0.
1.64,0.
-1.823,6
1.64,0.
1.64,3.281
-1.64,3.281
-1.64,0.
1.64,0.
1.64,0.
-1.458,6
1.64,0.
1.64,3.281
-1.64,3.281
-1.64,0.
1.64,0.
1.64,0.
-1.094,6
1.64,0.
1.64,3.281
-1.64,3.281
-1.64,0.
1.64,0.
1.64,0.
-0.729,6
1.64,0.
1.64,3.281
-1.64,3.281
-1.64,0.
1.64,0.
1.64,0.
-0.365,6
1.64,0.
1.64,3.281
-1.64,3.281
-1.64,0.
1.64,0.
1.64,0.
-0.001,6
1.64,0.
1.64,3.281
-1.64,3.281
-1.64,0.
1.64,0.
1.64,0.

Next time, maybe choose a better thread title like "Cleaning up my messy data".  And try to present your requirements more clearly, like you finally did here:

Cube1.txt look like this. Where First Character of first Row is X coordinate and next character of same first row is telling No of times X coordinate is repeating.
Then next rows from 2 to 7 (6 steps) are Y, Z coordinate...like that it is going.

by June Lee