Sort & SortIndices still a thing?

I'm looking at the Help documentation for Generative Components 10.06.00.93) and it points to simple sorting routines using Sort() and SortIndices().

However I don't see these listed as built-in functions - am I missing something or is the help outdated?

Short of writing an all out sorting function, is there a shorthand route to sorting a random point list, by it Z values?

Parents
  • Hi Robert,

    Those functions are now available as list methods. However, you can still use them as a global function. 

    There are two ways of sorting.

    1. By query expression- from pt in RandomPoints orderby pt.Z
      It will sort in ascending order. If we want to sort it in descending order, we need to add the keyword descending at the end of the expression.
    2. By Sort function - Sort(RandomPoints, function( Point A, Point B){return A.Z< B.Z;})

    We can use the above expression in an expression node.
    Please have a look at the sample example SortedPoints.gct

    Answer Verified By: Robert Jones 

Reply
  • Hi Robert,

    Those functions are now available as list methods. However, you can still use them as a global function. 

    There are two ways of sorting.

    1. By query expression- from pt in RandomPoints orderby pt.Z
      It will sort in ascending order. If we want to sort it in descending order, we need to add the keyword descending at the end of the expression.
    2. By Sort function - Sort(RandomPoints, function( Point A, Point B){return A.Z< B.Z;})

    We can use the above expression in an expression node.
    Please have a look at the sample example SortedPoints.gct

    Answer Verified By: Robert Jones 

Children