Grasshopper

algorithmic modeling for Rhino

Just getting started with building a complex definition and can't find a component that I want. The need is to use a Boolean Toggle to switch an <If-Then> condition.

i.e. -> if toggle=true_then_(input A + input B), false_then_(input A)->C

I am used to doing this logic but don't know how to do it in Grasshopper. I'm certain this must be in there but no luck finding so far.

TIA

Robb

Views: 34088

Replies to This Discussion

You can use simple script by using VB, C# or Python component.

hello,

would you please tell me what the ''t'' is here?

thanks

Scripting is very useful, but if you prefer you can also do if-then statements in an expression:

I was going to say this:


Ah I just did. Notice there is a search functionality in this site, I think this question plus it's anwers  can be found in the FAQ too (it should be)

Thanks for the reminder about search. I should have started there.

There's also two components that were designed to create a conditional flow. Specifically, they allow you to run some data through one subnetwork, all other data through another, and then merge them again.

First you 'sift' your data into several streams. By default 2 output streams are available, meaning that the component will work out of the box with boolean values. Then you do stuff to the filtered data, finally you 'combine' them again.

I attached a file which shows how to only perform an operation on all the negative numbers in a list:

Attachments:

This is way more than I need at present but really good to know about. Thanks David.

I know this is an old discussion, but this was very useful for me using the boolean toggle.

How can I use the toggle to choose between one part of a definition versus another? For example, in the above If Toggle=True, run this part of the definition, versus if False, another? I thought dispatch might do it but I cant work it out... Or is it a gate??

Help would be appreciated!

Thanks so much for this!! There were so many things that I learned by reconstructing it. 

happy wheels

That is just what I was looking for David Stasiuk... but the expression component in my version (.9.0076) only has 2 inputs on the left. Did your component come from somewhere else?

Zoom in to add more inputs.

Got it.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service