7
$\begingroup$

Is there a way in the repeat zone in geometry nodes to access the current iteration? I'm wanting to essentially create lines between points on two different curves via their indices, i.e. a line between point 0 on line 1 and point 0 on line two, with a line for each pair of points on each line. Programmatically, if this were run like a for loop, I'd just use the current value of the iterator as the index of the points. I know I could do it manually for each point and was hoping a repeat zone would get around that.

$\endgroup$
3
  • 1
    $\begingroup$ unfortunately - no. Just create a new input (integer), add an add +1 node and connect that between in- and output of the repeat zone. Name it: current iteration ;) $\endgroup$
    – Chris
    Commented Nov 9, 2023 at 16:08
  • 2
    $\begingroup$ and i am missing that too...! $\endgroup$
    – Chris
    Commented Nov 9, 2023 at 16:08
  • 2
    $\begingroup$ After fiddling a bit, I got most of the way there, except I hadn't thought to connect the value I was adding to into the output, so thanks for that last step! $\endgroup$ Commented Nov 10, 2023 at 17:25

1 Answer 1

7
$\begingroup$

First you'll want a counter. Note that count starts at zero, adds 1 in the repeat zone, then feeds back into count.

Next, you'll want two curves, and resample them to the same amount of iterations you want. A big trip-up with the repeat zone seems to be what happens inside vs. outside the repeat zone; at first this didn't work for me because I was using Geometry inputs named Curve1 and Curve2 and it wouldn't work.

Next, I sample index of each curve at the index of the count, sampling the position. I use that value for the start and end of a curve line. That's joined to the geometry. Here's the final result:

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .