Replicating GH1 Series Component Behavior

In GH2, I’m getting a little confused when I try to string together multiple numeric ranges and/or sequences, especially if there are long lists of input values or starting values other than 1. Is there an easier way to replicate the behavior of the old series component than this?

I’ve seen the answer below regarding the sequence component, which works fine for one starting value. But it seems like connecting a list of starting number values would require the concatenate component (which doesn’t appear to exist yet) to add n+ to every x, and in general seems clunky.

Also, are right-click accessed expressions for component inputs coming sometime in the future?

Bumping and restating: what is the best way to compose the two inputs below (n+x) to generate 4 sequences beginning at each x?

Probably not using the Sequence component. That one is a bit heavy handed. Today’s alpha release adds a couple simple numeric range components.

If you do want to use the Sequence component, the sequence function you’re looking for is S[n-1]+1 (at least I think it is, I’ve only got a Mac here and expressions don’t work on mac yet). S[n-1] gives you the previous number in the sequence, and +1 increments it. Once you have that the data inside the In input should be 1, 2, 3, 4, all grafted so they no longer share the same list.

But Range From Steps in today’s alpha release makes this a lot easier:

1 Like

If this range is not subject to variables, you can also hard-code it directly into an integer parameter by double clicking and typing a range expression into the pop-up box. If you want five numeric ranges, each containing ten steps, starting at 0, 1, 2, 3, and 4, you can type:

Screenshot 2022-04-21 at 22.45.12

which gives you a parameter like this:

1 Like

Hello,

Is there a guide for typing these kinds of expressions? Are there new expression formats in GH2 that didn’t exist in GH1?

Thanks for the replies David. I tried Range from Steps earlier, but couldn’t get it to generate a 1-item list since it doesn’t accept 0 as a step input (worked fine for 2, 3, 4…etc item lists). I’m trying to generate pyramidal lists of numbers.

I’ll try your other suggestions soon.

They’re based on DesignScript range expressions, though I had to write the implementation from scratch. The range components output range expressions if they can.

Here a rough list:

A..B → from a to b using unit steps.
A..B..C → from a to b using c-sized steps.
A..B..#C → from a to b in c steps.
A..#B..C → from a take b c-sized steps.

You can also embed range expressions into the a, b or c fields. So [0..3]..10 actually yields four consecutive range expressions: 0..10, 1..10, 2..10, and 3..10.

3 Likes

Expressions (the regular kind, not the range kind) are now pure C#. I’ve done some extra work to get things like factorials and squares working the way they used to in gh1, and many functions (sin, abs, acosh, …) are available directly.

Benefits of this; you get conditionals and loops and custom variables and multi-line expressions. Downsides; expressions can now potentially do damage.

2 Likes

I can probably make it accept that.

Would be great!