[Grasshopper] How to use Equality to determine matching values and perform conditional branching

[Grasshopper] How to use Equality to determine matching values and perform conditional branching Grasshopper component EN

This article explains how to use Equality to determine matching values and perform conditional branching.

Equality1
Equality2

On the Grasshopper, it is represented by either of the two above.


↑Youtube Channel

Determine whether a value matches the specified number and perform conditional branching

Using Equality allows you to identify and conditionally branch based on values that match the specified number.

Determine whether a value matches the specified number and perform conditional branching

Equality(A) takes any list of numeric values.

This time, we are concatenating a list of random numbers between 100 and 300.

Connect any numerical value you wish to examine to Equality(B).

This time, we’re connecting 100.

Then, Equality(=) outputs True when the specified value is met.

If the specified value does not match, False is output.

On the other hand, Equality(≠) outputs data representing the opposite state of Equality(=), namely True or False.

conditional branching1
conditional branching2

Additional Components: ① Dispatch

To perform conditional branching using acquired True/False data, using Dispatch is convenient.

Connect Equality(= or ≠) to Dispatch(P).

Furthermore, connect the original numeric list to Dispatch(L).

Then, as shown in the two images above, we were able to implement conditional branching.

conditional branching3

Additionally, by connecting data to Dispatch(L), you can also use other data to conditionally branch based on True/False information.

The image above shows the result when the text data A through G is connected to Dispatch(L).

Then, using the True/False information obtained with the value 100, we can conditionally branch the character data A through G.

This time it’s text data, but it can also be applied to points, lines, surfaces, and more.

List of Grasshopper articles using Equality component↓

Comment

Translate »