how to get points attribute in single wrangle

   1796   2   1
User Avatar
Member
10 posts
Joined: March 2017
Offline
Hi, this is my first question.

I simplified what I wanted to express in this VEX.
Using For loop, get the position of point one step before and create a new point that relatively adds the position,
and I try to create lines by connecting them.

In picture1, I realized getting the points by using “addpoint”, and connecting them by “addprim”.
In picture2, I wanted to do the same thing in single wrangle, but I couldn't get a point position by
point(geoself(), “P”, i)


I don't know why this happens, and I want to know how to solve this in single wrangle.

Attachments:
picture01.PNG (217.0 KB)
picture02.PNG (170.7 KB)

User Avatar
Member
2041 posts
Joined: Sept. 2015
Offline
You can't do that in a single wrangle when creating and setting attributes during loops like that.

This is not technically accurate, but to say loosely:

you can't set/create attributes during operations that depend on those new values, i.e. each loop tries to access the newly
set/created values of the attributes.

With attributes, even in detail mode you have to think in terms of stages, there's the incoming attributes being referenced first,
then the code, then the output of those attributes.

But, if you set up local variables(ones that represent the incoming attributes and/or new ones); They can be worked on and modified according to your codes logic. Then when that is finished, you can apply it to existing attributes or new ones.
Edited by BabaJ - June 20, 2019 16:03:06

Attachments:
addpoint to previous.hiplc (84.3 KB)

User Avatar
Member
10 posts
Joined: March 2017
Offline
Thank you for your advices, and I appreciate you uploaded file.
It seems very difficult to what variables to store and what variables I can call…

I will use local variables to handle attributes.
  • Quick Links