Grasshopper

algorithmic modeling for Rhino

Hello everyone,

I would like to know if there was a way to increment a serie of number for example by clicking on a button. In another word, have a kind of number slider but it would go from one value to the next one by pressing a button 

Or it could just add "1" by pressing the button.

Or alternatively activate a random function.

Is there a way to achieve this? I don't post any image or file as I don't have a valid lead.

Views: 5908

Replies to This Discussion

--

David Rutten

david@mcneel.com

Attachments:

Hello and thanks for the answer,

so if I understood this, the record data component stores all the values of the imput. For each click the button says "True" and then "False" on release. So it creates 2 values. And the list length returns the length of the list which grows by 2 on each click.

When I opened your file, I had no expression on the list length component, so I don't know what you've written there. But I thought about using a Cull Nth component after the record data to get only one value instead of two (true and false) so the list grows by 1 with a click on the button. Is it a good solution?

I opened david's file but got the expression. Its reads:

Max(0, (x-1)\2)

Tested the Cull Nth  idea you commented about and seems to work the same.

And would it be possible to use a button to switch the input of a component.

For example, I need a number and I want to be able either to set it manually or with the Z value of a chosen point. So I can create a link from one of both components to the number component. And after create a link between the other and the number component. But I'd like to know if it's possible to make it work with a switch button, or a boolean toggle.

If you have some clues, I'd be glad. I'm a beginner but I don't ask for a solution already made as soon as I'm stuck, but some leads could help me reach my goal.

The file I'm uploading is quite empty but there is at least two value imput and the incremental button (I don't really know if it can be useful here). Thanks again

Attachments:

Clement,

le "button" permet d'activer une valeur pendant l'activation de celui ci.

Le "boolean toogle "permet de switcher entre deux valeurs permanente.

Ta question pour avancer d'un pas est diffèrent mais David à répondu, avec une petite opération mathématique, tu pourra avancer par pas de 1.

Remy

J'avais saisi la différence entre le "button" et le "toggle". Mais ce qui me gênait par rapport au "boolean toggle" c'est que je pensais qu'il renvoyait seulement "True" ou "False". Et donc je pensais que l'exemple que tu as montré avec le "stream filter" n'aurait pas marché, étant donné que le composant attends un index et pas un "True/False". Donc je pensais qu'il fallait transformer le "boolean toggle" pour lui faire "dire" 0 ou 1. Et je bloquais là.

Par rapport à l'incrémentation de 1 avec un bouton, je l'ai fait fonctionner avec le "Cull Nth" mais pas avec l'expression de David.

 hi Clement,

Looks like Remy bit me too it while i was creating input option and showing you gate too.. As my french is rather non-excistant i can't tell is he has told you that you can't enter more than one value in to the filter ot the gate at a time.

Hope this is some help.

Attachments:

Hi Matt,

I'm understanding a lot of things. It did help, yes. For instance, I didn't know there was the "+" to add imputs or outputs to a component and that's quite useful.

I got how Stream Filter, Stream Gate, or even Explode tree, and I guess I'll be able to understand more of the data tree management.

Thanks for your time, Matt and Remy. I'll post example of what i've done with these function if you want. 

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