Combine two integers to a list?

I’m still trying to grasp some Grasshopper basics… like how, for example, an output from a node can be a multiple objects or values…

So, how do you get those multiple values? For example, here, I’m trying to prune the first and last index from a list, but I can’t figure out how to get both integer nodes to connect at the same time:

image

Note, this is an example! I know I can use a single integer node to enter multiple values, but the slider is there because it represents a different type of node that I get my last index value from.

(Also, why on earth is the number 7 displayed even though I have a completely different number value in that node?)

EDIT: Also just tried this, but the result is not as expected either, perhaps because my integer was 0?

image

Use shift+drag if you want do connect multiple wires to the same input

That did not have the expected result. The output should have 12 values, not 24…

Without knowing what is happening to the left of your image it’s kinda difficult to answer so please post the model (if you are pulling objects from a Rhino drawing you can internalise them in the receiving components so you don’t have to upload the Rhino file too).

But one thing: unless you changed the domain, indices run from 0 to Length - 1 so you need to subtract 1 from Length to reference the last item in the list.

That did not make a difference.

But I don’t understand why you need to see my model in order to tell me how to combine two integers into a list of indexes so that I can use it to cull a list of curves? (Again, sorry, but I’m not 100% sure I’m using the correct terminology here, either…)

For reference, culling using either of the inputs in the above picture works fine. It culls the first OR last element in the list. But using shift to put both inputs there, as previously suggested, creates a dashed output and apparently two lists with 12 entries in each, which is not what I thought would happen. I want to cull the first AND last element.

It will be because there is a data structure associated with your list length component:

Flatten your output from list length and it should work:

@ivelin.peychev has already shown you a perfectly valid way to combine two integers. It isn’t giving you the result you want because of the way the upstream data is structured. By seeing your model we could easily highlight the source of the issue for you.

btw, I prefer using the “merge” component instead of dragging multiple wires. Do that and flatten the output.

Thank you, that was the answer I was looking for!

1 Like