VEX Code Access "Group" Parameter

   4227   1   2
User Avatar
Member
1 posts
Joined: Jan. 2017
Offline
Hello Guys,

I am trying to print point position information based on the points I set in the group parameter.

but I can't loop over the @ptnum, I also tried to use an increment variable, but it's always the same.


here's the snippet:


can anyone help on how to get the input from group parameter in vex, something like
int pts[] = [ 3, 4, 2, 0]

cheers.
Edited by neil_math_comp - Feb. 9, 2018 09:28:10

Attachments:
2018-02-09_16h20_10.png (15.0 KB)

User Avatar
Member
1743 posts
Joined: March 2012
Offline
There's the expandpointgroup [www.sidefx.com] VEX function, e.g.

int points[] = expandpointgroup(0, chs("group"));
int n = len(points);
for (int i = 0; i < n; ++i) {
    int pt = points[i];
    ...
}

However, it's important to note that you'll need to do this with “Run Over” set to “Detail (Only Once)”; in that case, the node won't use the Group field for its own iteration, since it will run only once. What's happening in the snippet you posted is that VEX effectively runs the code snippet independently for each point, so each one creates a new variable i, sets it to zero, then prints that out.

Hopefully that helps out.
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
  • Quick Links