Basic qery

Hi All,

I am facing few basic problems in analysing results of a list.
two points:

  1. how to create a “List” or an array of results into a "Lists.(fyi the results are being generated in a loop)
    2.“Sort” through the “List” and select the highest value in it.

I would really appreciate guidance to carry forth this logic in the rhinoscript.

best regards,

What language? If python:

There are many ways to create lists - look at the Python help here. You can, for example create an empty list and append items successively to it:

mylist=[]
mylist.append("spam")
mylist.append("eggs")
mylist.append("ham")
print mylist
>>> ["spam","eggs","ham"]

You can sort the list with

mylist.sort()

this sorts the list in place. Or, you can make a sorted copy:

mysortedlist=sorted(mylist)

To reverse sort just add the keyword reverse=True

mylist.sort(reverse=True) or mysortedlist=sorted(mylist reverse=True)

HTH, --Mitch

oh the the language I am using in this code to carry out this logic is visualbasic.net in rhinoscriptinng.

But thank you for input @Helvetosaur, could you advise me on how to proceed using this language please?

I get the idea with your function, but I have written a few lines below and I presume there is mistake somewhere in the statement(I required the highest number of the list hence Ubound)

list = array(Total)
a = sort Ubound(list)
best = fixarray(a)

fixarray is a function: to obtain one element from a list.

Function fixArray(list)

fixArray = list(0)

End Function

could you see the problem with the logic in the first few lines?
I really appreciate your help.

Hi Alan,

Are you using RhinoScript (e.g. VBScript)? If so, then these array utilities might be helpful to you:

Does this help?

– Dale