Grasshopper

algorithmic modeling for Rhino

I'm curious if there is a way to use expression editor to index into lists. For example if there are two wires coming into one input, can I index into them to combine both in a function rather than both being processed independently and output as separate. I imagined something like this.

∑(Num[0], Num[1])

What syntax should I use to achieve this where I would have only one output - 0.88, rather than a list of two values. Or is this not possible?

This would allow me to use the expressions editor in many instances and avoid using many additional components for mundane tasks such as add, multiply, Sqrt etc.

Of course in the example I have given, I could use a function component F2 but I'd like to get the full potential out of the use of expression editor.

Jonathan

Views: 3319

Attachments:

Replies to This Discussion

This is not possible. Expressions inside parameters always operate on all items individually. If you want this kind of expression, you could use an expression component with two inputs and two wires.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

The only way to do what you are trying to achieve is to use a scripting component.

You have to set one of the inputs as "list access", you can then access the data connected to that input as an array, as in your example: a = x(0) + x(1)

 

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service