Dear Experts,
I have a foreach by number loop in which I'd like to set the number of iterations to the value of a previously calculated attribute "@loopIter".
This attribute is visible in the geometry spreadsheet on the foreach_begin node and subsequent nodes in the loop, except for the foreach_end node, which is where I need it to give its value to the "Iterations" parameter. When I right click on the Iterations parameter and use the Reference menu option, I can sometimes see this attribute as being visible as a point attribute. Sometimes it is not listed, and I don't know what influences its visibility. When it is listed, though, and I select it, it gets a value of 0 rather than the correct value, so I guess it's not really there.
Should it be? If so, what am I doing wrong? Am I not approaching this problem correctly?
Thanks so much,
Mary
Trouble accessing local attributes in foreach loop
2179 6 2- mgbaker
- Member
- 73 posts
- Joined: 4月 2020
- Online
- vusta
- Member
- 555 posts
- Joined: 2月 2017
- Offline
a bit convoluted trying to guess your aim so i could be on the wrong track....sue me.
just go into the control and drag around Target. Naturally, you can adjust Iter Distance too.
(just doublecheck if you need to + 1 in the points in the line creation ie. if you want a line to have 4 divisions, then it has 5 points)
just go into the control and drag around Target. Naturally, you can adjust Iter Distance too.
(just doublecheck if you need to + 1 in the points in the line creation ie. if you want a line to have 4 divisions, then it has 5 points)
Edited by vusta - 2021年5月29日 22:27:01
- mgbaker
- Member
- 73 posts
- Joined: 4月 2020
- Online
Thanks, vusta. I guess that is a different way to approach it -- copy the grid to each place first, then iterate across the grids doing what my null ("do_some_things") placeholder represents. I'll give that a shot.
I'm still curious, though, if anyone knows how to get the access to local attributes to work in the foreach_end parameter!
Thanks again,
Mary
I'm still curious, though, if anyone knows how to get the access to local attributes to work in the foreach_end parameter!
Thanks again,
Mary
- Konstantin Magnus
- Member
- 670 posts
- Joined: 9月 2013
- Offline
Hi Mary,
I think you would rather set the number of iterations to a detail attribute. Then access its value using the corresponding expression:
I think you would rather set the number of iterations to a detail attribute. Then access its value using the corresponding expression:
detail('../volume_size', 'loop_iterations', 0)
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
- mgbaker
- Member
- 73 posts
- Joined: 4月 2020
- Online
Thanks, Konstantin -- indeed in VEX that is what I would usually do. But if I were to try to make use of the foreach SOP -- how do I access that attribute in the foreach_end SOP Iterations parameter to set the iteration count? The attribute doesn't seem to be available whether it's a point attribute, detail attribute, or primitive attribute...
Thanks again,
Mary
Thanks again,
Mary
- vusta
- Member
- 555 posts
- Joined: 2月 2017
- Offline
well if you put
in the Iterations at the end, you'll get 4
change your Distance in control to 0.25 and you'll get 8 iterations
(probably a bit confusing when you say local attributes tho, the loopIter are attributes that are readily widely avail, not just temporary local to some wrangle)
point(0,0,"loopIter",0)
in the Iterations at the end, you'll get 4
change your Distance in control to 0.25 and you'll get 8 iterations
(probably a bit confusing when you say local attributes tho, the loopIter are attributes that are readily widely avail, not just temporary local to some wrangle)
Edited by vusta - 2021年5月30日 17:34:51
- daverosesumo
- Member
- 17 posts
- Joined: 11月 2019
- Offline
-
- Quick Links