Grasshopper

algorithmic modeling for Rhino

I have a problem like this:

 

I have a list of number for example: 1 2 4 5 6 4.5 6.6 5.6 6.4 3.4 6.7 6.4...

 

I need to write a definition: if numbers in this list is more than 5 change them into 5.

 

I seek a changed list: 1 2 4 5 5 4.5 5 5 5 3.4 5 5...

 

Thank you in advance:)

Views: 1278

Replies to This Discussion

Check validity with a ">" component. This component is going to give you a true false list. Multipling True values with a number returns the same number, multipling False gives you 0. Then use the same true false list to insert number 5 instead of zeros. Perhaps you will need to put some NOT booleans operators ove there to make what you want with booleans values.

 

The "If" function inside funtions components (F(x)) let you make some "if operations" but I've never used it.

 

Best.

 

 

Use the Min component (in the Math tab) and input your list and the number 5.
Nice aproach :)

thank you

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service