Sort by location point from CAD's curve

Hi,

i want to extract the coordinates from CAD layer, but it should be sort by based on location so when i extract the coordinates it gets shuffled so i used to sort byusing list.sortnatural node after sorting i tried to extract the start point and end point separately but it shows en error like this.

Hi!, What’s the output in the List.SortNatural node?

Geometry.point but after connecting to startpoint , it shows as a string

What does the “Object.Type” node show for both sort natural nodes?

Hola amigo @cmrlircon.bim buenas.
seems like your node List.SortNatural, or the first one Convert from InternalOrigin, gives as output a dictionary, you will have to get into the dictionary and read values in order to use the points inside the dictionary!

sorry cant get your points could you please explain briefly?

its string only but i dont know why its became string.

Might sound silly, but what is the object type of the output of your convert from internal origin coordinate system node that goes into the natural sort node?

I cant understand why it comes like this but my requirement is i just want to sort my curve’s coordinates into ascending order

Natural sorting is specific to strings. Numbers already sort “naturally”. So when you supply an object type other than a string, the input gets stringified so that it can be sorted naturally.

On top of that, geometry can’t be sorted. How would you expect a point to be sorted? By X coordinate? By Y coordinate? By Z coordinate? By all three? In what order? You have to do some additional lifting to sort a point based on whatever properties and logic you are expecting. There are already a bunch of existing threads dealing with sorting points (or elements) by coordinate location that should give you a starting point (if not provide a full solution). Try searching for similar topics and see where you get.

2 Likes

Hola de nuevo amigo @cmrlircon.bim buenas.
here is your problem, the node List SortNatural has changed your point into a string, Point and Strings are diferent datatypes, if this doesn’t say you anything you must go read again dynamo primer (the handbook of dynamo, you find it under Resources tab :backhand_index_pointing_up:).

Each node has parameters, if you hoverover the mouse on the parameter the tooltip shows you the data type you must use to feed the parameter, dynamo is saying to you that you are ussing a wrong datatype