How to obtain minimum and maximum values from lists in Grasshopper - Version 2

In this previous post I showed the ways in which we can obtain the minimum and maximum values from lists of numbers in Grasshopper. I presented three solutions, using native Grasshopper components (with unintuitive naming), building your own using a C# script, or using a component which I offered for download.

Since then, I found I needed some additional functionality of my list min/max component, namely, I wished to set some bounds for my values to be above to below. This came from the data which I work with which contains 'out of range' numbers to indicate errors or null values. For mesh colouring in Rhino/Grasshopper, these values provide the mesh with colours which are also out of range (if using a gradient) and do not interfere with the primary meshing results.

However, if I wish to find the minimum and maximum values of the data, using the component previous presented doesn't work, as I would end up with -1 and 1e10 as my minimum and maximum values due to them being the out of range numbers in my data sets. So I modified the component to accept a minimum and maximum input, as seen below.

Version 2 of the list min/max component offering additional functionality

Version 2 of the list min/max component offering additional functionality

What's different in V2?

The only major difference in V2 is the addition of a min and max input. In the min input, you specify the minimum value which your data must be above to be valid (and return a correct minimum data value). In the max output, you specify the maximum value which your data must be below in order to be valid (and return a correct maximum data value).

So if you have the same data bounds as I do, you would plug -1 into the min input and 1e10 into the max output, and the resulting min/max values coming out of the component will be between these bounds.

You can download the V2 component here.

Alternatively, you can download the V1 component here.

Leave a Reply

Your email address will not be published. Required fields are marked *