Forgot password?

Create an account!

Forum

« back

RhinoScript – Sort Methods

Messages

Please log in to write a message.

  • 3. jhg4556 (Jun 02, 2011 01.22):

    Thanks. Did not know it existed. Useful to know. Completed it in Python meanwhile, it has sort() and groupby()

  • 2. Johannes (Jun 01, 2011 20.29):

    did you took a look at hanno's array_library (rhinoscript.org/rhinoscript/37)?

    there are to functions:

    1. array_sort()

    ' returns an array with all values from an input array sorted from min to max
    '
    ' IN: Array: the array to sort
    ' OUT: Array: the sorted array

    2. array_nsort()

    ' returns an array with all values from an input array sorted from min to max
    ' this function works on nested arrays. The elements of the outer array will be sorted using the elements of the inner arrays at the specified index
    '
    ' EXAMPLE:
    ' myArr = array(array(1, -2, 3), array(15, 5, 0), array(0, 3, -50))
    ' mySortedArr = array_nsort(myArr, 1)
    '
    ' Now mySortedArr looks like this: array(array(1, -2, 3), array(0, 3, -50), array(15, 5, 0))
    ' (the inner arrays remain unchanged but are sorted after their elements at index 1)
    '
    ' IN: Array: the array to sort
    ' Integer: the index to sort after
    ' OUT: Array: the sorted array

  • 1. jhg4556 (May 30, 2011 02.10):

    I have been reading this on using .NET classes to sort arrays but do not manage to sort using keys as show in the link No. 2. Can someone show me how to do it (in Rhino 5)? I am trying to sort some curves by their height.

    wiki.mcneel.com/developer/scriptsamples/dotnetsort

    msdn.microsoft.com/en-us/library/85y6y2d3.aspx

    Thanks.

Recommend

Why are these buttons gray?