Sorting Curve List A by Curve List B

Hi Everyone,

I have (2) lists of curves. I want to match sort order of List B to List A.

Thanks for any help in advance!!!

Mitesh

1 Like

So you have an unsorted list A, a sorted list A, and you want to switch elements in the unsorted list B so that they match the sorted list A ?

If List B are the same elements as List A but in the wrong order, yet List A is the right order, why not just use List A? Otherwise, can you explain how you want it sorted?

You can sort your list with IndexOf and List.GetItemAtIndex.

1 Like

Edit : Same method as Alban, really

2 Likes

So Basically List B is well organized for Point X and Y and not Z. However, List A is having correct Point Z values

Basically, Idea is to sort the list first then replace corrected Point Z values.

Thanks,
Mitesh

You have to replace the corrected Point Z value first.

So just you know, Point Z value is not going to be constant.

From what i get, you just want to replace the Z coordinates in the B list by the Z coordinates in the A list. Is that correct ?

If not, could you write your own example with like, say, 5 points in both lists ?

I want to replace Z values from List A to List B. But My List A is not sorted out for X and Y.

Then just deconstruct the points by their coordinates, and reorder as we showed you, then recreate the points.

I’ll post it here when i’m done.

I suppose for sorting by X and Y, extra steps may be required but essentially this.

Here it is. Re-ordering list B so the X and Y coordinates match those of list A. It is just an application of what Alban posted earlier, on a more elaborate example.

home.dyn (25.1 KB)

3 Likes

Can you please let me know that package name of “List.IndexOf” node?

I can’t seem to find one in my packages

Thanks,
Mitesh

It’s an Out of the Box node. Available as you install Dynamo. I’m using 2.0, but i think it is available in 1.3 also.

I am using 1.3.2 but didn’t fine one. Also, Your DYN file seems corrupted or may be because of its created in higher version i guess.

It also exists in 0.9 so you really should have it somewhere… Nothing comes up if you type “indexof” into the search field?

Else you may want to reinstall Dynamo.

Thank you everyone!!

You suggestions worked really very well…

I have marked this post as solved

Mitesh

I have a same problem but my list have some point have same X or Y, can you give me a advice?

@Mr.Coffee

Try this…

2 Likes