Grasshopper

algorithmic modeling for Rhino

Hello All,

 

I have a list with both positive and negative values. I need to replace all the negative values with zero and maintain the original tree structure. Does anyone know of a good way to do this?

 

Many thanks!

 

Views: 3841

Replies to This Discussion

That did the trick. Thank you very much!
I should have posted this...

You could also use the Max() function, it's slightly less typing:

 

Max(x, 0.0)

 

Max() returns the higher of two numbers, so if x is less than zero, zero is returned. there is even a Max component (Math.Util), so you don't have to resort to expressions at all.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

even better!
You can use an If statement in the Fx component. Just replace my x*y in the example with your existing function: If(x*y>0,x*y,0)
That works too! thanks Danny.

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