ForEach Loop[Solved]

   6216   2   1
User Avatar
Member
3 posts
Joined: 10月 2016
Offline
I watch a tutorial on GaTu. He uses “copy stamp” to loop. How I get the $CY(or equivalent) into “ForEach Loop”? He uses it into a switch
Edited by ditsikts - 2017年7月20日 13:29:09
User Avatar
Member
1743 posts
Joined: 3月 2012
Offline
There are a couple ways, depending on what you'd like to do.

If you're doing some operation for each point, you can press the Create Meta Import Node button on the Block Begin node to create another Block Begin node with Method set to Fetch Metadata and Block Path set the same as the other Block Begin node. If you're just doing a For Loop with Iteration Method set to By Count and Gather Method set to Merge Each Iteration, you can just set the Block Begin node to Fetch Metadata directly.

That metadata node's geometry will have two detail integer attributes, iterationand numiterations, with iterationbeing updated each loop, starting from 0, which I think matches $CY. In the Iteration Method set to By Count case, there will also be valueand ivaluedetail attributes. I suspect that they correspond with the values implied by Start Value, Increment, and the current iteration number, (i.e. value = (Start Value) + Increment*iteration), but I haven't double-checked.

If you're going over a set of points, another alternative is to add a point attribute ahead of time in an Attribute Wrangle: i@pt = @ptnum;
Hopefully some of those ideas help out!
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
3 posts
Joined: 10月 2016
Offline
metadata node works fine using iteration, this variable(iteration) should be a “click” for enable it into foreach_begin
Edited by ditsikts - 2017年7月20日 13:54:43
  • Quick Links