Grasshopper

generative modeling for Rhino

# Need help fast with list radius of circles in image sampler

I need help fast

I'm doing an image with image samples and use the output numbers for the radius of circles.

I want the numbers between:

10 and 15 to turn into to 12

15,01 and 20 to turn into to 18

20,01 and 30 to turn into to 25

How do i do that?

Views: 195

### Replies to This Discussion

You could use a very complex expression, like so:

If(r <= 15, 12, If(r <= 20, 18, If(r <=30, 25, -1)))

It's not exactly the same as your logic, but it first tests the radius to see if it is smaller than or equal to 15. If it is, the function will return 12. If it isn't, then the radius is compared to 20, and if it's smaller than or equal to 20, the function will return 18. etc.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

This is another method. A bit less geeky but also somewhat less well defined. Values on the transition between two adjacent intervals might give unpredictable results.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

Thank for all the help

But it still doesn't work for me

I have uploaded the files

btw i'm new at this

Attachments:
i have made a foolproof example, with comparison by david (as posted above)

here is your modified file

*removed due to a found bug*

Behold the power of Expressions!

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

Thanks a lot guys..

It was about the same thing I was doing, except the multiplications wasn't working for me.

• Add Photos
• View All

## Videos

• ### Towers by :-Ar.Aparna Shridhar

Added by Aparna

• ### [RvsR]₂ - Sound Eliminator

Added by Mgeorgio

• ### [RvsR]₂ - Weather Control Box

Added by Mgeorgio

• ### [RvsR]₂ - RKR

Added by Mgeorgio

• ### [RvsR]₂ - Light Septums

Added by Mgeorgio

• ### Woodpecker Use Case III: A parametric roof structure

Added by Hanno Stehling

• Add Videos
• View All

© 2013   Created by Scott Davidson.   Powered by