Grasshopper

algorithmic modeling for Rhino

Hi forum,

I would like create a function If on expression designer.

 

Apparently I must be mistaken in what format to use.

Views: 4975

Replies to This Discussion

"a=b=c=x" does not mean "a, b, c and x are all identical". Instead, the equality comparers are handled in sequence, resulting in the following (((a=b)=c)=x) notation. So in effect there are 3 operations that happen consecutively:

  1. Compare a to b, store the result as T0
  2. Compare T0 to c, store the result as T1
  3. Compare T1 to x, return that value

So let's assume a, b, c and x are all integers and they are all 5. Then:

  1. a = b → 5 = 5 → T0 equals True
  2. T0 = c → True = 5 → T1 equals False
  3. T1 = x → False = 5 → expression result equals False

If you want to compare 4 values for equality, I'm afraid you'll need to use a more elaborate notation, something like:

If ((a=b) And (a=c) And (a=x), "Pt1Pt2", "")

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Well thank you david, this helps me much. This is the basic math, sorry for the inconvenience.

 

I actually assign points based on criteria well defined: In both cases entry may open curve closed curve. (C1 or C0)
In the case of C0: I have four other cases
In the case of C1 I have three other cases

If C0:
Pt1-Pt2 = 1 = 0
2-Pt1 = PTC1
2-Pt2 = PTC2
4-No Equal
if C1
1-Pt1 = PTC1
2-Pt2 = PTC2
3-No Equal.

Its become difficult to manage these conditions..

 

Thanks

Hello David, I have another worry now, the apartment number of function "if" is limited?
Or maybe even a syntax error.

 

If ((a=b) And (a=c) And (a=x), "A1",If((a=x) And (a=b) And (c=y), "A2",If((a=x) And (b=y) And (c=x), "A4",If(a=x) And (b=y) And (c=y), "A3",If((a=y) And (b=x) And (c=y), "B1",If((a=y) And (b=y) And (c=x), "B3",If((a=y) And (b=y) And (c=y), "B2","Erreur"))))))

 

There's a limit in MS Excel IF Function, so maybe a VB thing.

Ok I'm going to start on.

How about something like this where you add all the numbers up and get an ID number for a particular case.

If you want to test a list of values for similarity, you can probably use the [Create Set] component. If your resulting set only contains a single member, all your variables had the same value.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

I'll stay on the idea of making a component for I fear that the definition will lengthen.

Thanks for your reply

Trying to set up the vb code I saw that he was missing a parenthesis. all the air to operate ....

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service