Grasshopper

algorithmic modeling for Rhino

Hi all

I need to create some kind of logics operation where depending on ab one value must change to 1 to -1. I know i'm really close to it, but I'm missing something. In case it was not clear enough, I need to change the sign of a value depending on the value of "z" in a point position. If its bigger than... then have to be 1, if its smaller than... then should be -1.

I hope it was clear enough. THANKS

Views: 270

Replies to This Discussion

I had this problem recently you can find the results here.
http://www.grasshopper3d.com/forum/topics/is-there-a-more-elegant-way?
I checked that and its not exactly what I'm looking for. I need some kind of a door, where depending on the value that comes in, should change one value to another.
Attachments:
So you've got a list of TRUE/FALSE values and you want to obtain a list that when TRUE you get "1", but when FALSE you get "-1".

There are several ways to obtain this. A tacky but quick way is to convert the true/false values to 1/0 values respectively just be connecting the list to an integer parameter.
Then you can use an equation like "-1+2*x" to change the values from 1/0 to 1/-1.

A better solution would be to add them to a vb.net component and use the following logic:

if x then a = 1
else
a = -1
end if

For most logical operations (at least for me) it's much easier to use some simple code in a vb.net component that try to solve it with components.
Thanks, it was easyer than I thought. The simple equation helped a lot. I was making a mistake by checking twice (to check the same list two times for bigger than...and smaller than... had no sense at all).

Thanks Vicente and thanks Danny, both approaches made me arrive to what I was lloking for.

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