Separate group for each point selected in a group range

   1663   1   0
User Avatar
Member
9 posts
Joined: Nov. 2020
Offline
Hello all,
complete vex noob here, I am trying to create a seperate group for each point selected via a group range, so that later i can use an add (by group) to join all the points in the created groups together...
Any ideas how to do this?
many thanks!
User Avatar
Member
9380 posts
Joined: July 2007
Offline
how do you expect the groups to be separated?

lets say your group is named range_group and contains points 5-7
if you have different group for each point of you end up with groups: group_pt5, group_pt6, group_pt7
then what do you expect Add By group to do?
since each group will contain 1 point it will not create any line
if you however use range_group in Add SOP directly then it will create line through points 5-7

so I guess my question is what are you trying to achieve?
also it's much more efficient to deal with attributes instead of a lot of groups, but also depends on the goal

but just to blindly answer the question on how to create a group for each point of another group in point wrangle:
string source_group = "range_group";
int pts[] = expandpointgroup(0, source_group);
foreach(int i; int pt; pts){
    string group_name = sprintf("%s_idx%d_pt%d", source_group, i, pt);
    setpointgroup(0, group_name, pt, 1);
}
Edited by tamte - May 29, 2022 02:25:36
Tomas Slancik
CG Supervisor
Framestore, NY
  • Quick Links