Grasshopper

algorithmic modeling for Rhino

so i am trying to sort a list of numerical values based on its range. for example i have a list of 400 values ranging from 0 - 1000. i want to group them into 5 groups.

group 1 - 0-200

group 2 - 201-400

group 3 - 401-600 etc.

How should i go about that in grasshopper?

Thank you,

konrad

Views: 8256

Replies to This Discussion

So i am trying to sort an output values from Ecotect analysis. I am not sure why the Evaluate component is unable to process those values. Ideas?

I am thinking that if i can get an expression to create ranges ex. X<200 then 201<x<400 etc. then i can use a Cull component to create sorted lists that will contain values just within those ranges. I just cant get that Evaluate component to work? Ideas? thank you

Attachments:

Hi, 

Just a quick thought: try not to use a panel to feed data to a eval.

Plug the data to a num comonent.

Can you explain what are the advantages to that? Is it wrong? I am basically doing that just to "see" what I am feeding to that Evaluate Component. Thank you for reply.

The panel is basically a Text parameter with a special display. It will convert all data to text. Some data can be losslessly converted to text and back (integers, colours and booleans for example), some data can be converted in a lossy way (floating point numbers for example may lose accuracy as not all digits are written) and other data cannot be converted at all (curves, meshes and surfaces for example).

Panels are great for looking at data, for writing a bunch of constants, but they should not be used 'in between' components unless you specifically want to convert data to text.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

David, Thank you for clarifying that. I will make sure i never use the Panel in between components like that again. I honestly thought that it was just a display tool and that it was not modifying any data flowing through it.

Hi konrad,

You can also use Partition List component

This looks like it might work. However, as you have noticed I am working with values from the Ecotect using Geco plugin. The reason I am trying to sort out certain ranges is that I want to assign colors to different ranges. With your solution, how do i assign a color to items on that list...can i call out each of those partitions? Item List perhaps? Thank you.

If what you want is to visualize the data to the surface, the data shouldn't sorted. 

Because index of the list that you have been analyzed in geco is an order of each surfaces.

Use : Bound component > domain component > gradient > custom preview 

EDIT: I think Geco plug in have a component for visualize the value with RGB color, I don't really know how to do that, maybe you can ask in Uto group.

Yes, you have a great point. Each surface has a number assigned to it and those values are in a specific order corresponding to the surfaces.

In that case i need a conditional "filter" that will Evaluate each value and assign color to it based on the range that it falls into.

Yes, Geco has an RGB output parameter that will let you assign those colors, but i am not sure if i can control the number of ranges that it will assign to each analysis. I want to truncate that output and let's say instead of using 20 different colors to represent that data, i would like to have only 5 colors. That will extend the ranges considerably. I will look at the Geco components and see if i can control that directly there without need to filter the output values.

Thank you for your help. I will get back to you when i have time to look at it.

like this?

Attachments:

Guys,

Thank you all for help. This seems to be a little bit more complex than i have thought. Here's my set up with Ecotect and Geco.

Geco assigns either an RGB color or a value to each polygon based on its solar exposure.

Now, i am trying to figure out a way to sort that list. I want to assign my own color to panels based on the value that ecotect assigned to them that falls within a specific range.

I am thinking that i cant cull that list like David Stasiuk has suggested because then values will randomly get assigned numbers from 0 up. I need to keep the output value matched with the polygon that it belongs to.

Any idea how to sort that list without killing its order?

ps. Imagine that down the line i want to assign a panel to each surface based on its solar exposure value. I want to standardize the panels and minimize the number of custom panels so that's why i am thinking i need to define ranges. This way i will reduce a number of panels.

thanks a lot!

Attachments:

I don't have Geco, so I can't check your file. But you could create an index list (use a series component that starts at 0 and runs according to the length of your initial list) and cull it parallel to the data itself...that way you'd always know which index was sorted into each group, and where it lies in the output list.  Then you could assign whatever properties you wanted into each group and recombine the data using the indices to put them back in their original order.

Here...maybe this can help...

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service