Grouping points with the same attribute value

   6444   5   1
User Avatar
Member
118 posts
Joined: Feb. 2016
Offline
Hi there,

given a series of points with a custom attribute @att, how can I generate a series of groups (group1, group2, etc) based on points that share the same value in @att?

There's probably an easy solution, but I couldn't find any info about and I've already spent some time on it..

Thanks for any help
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline

See the attached example. I always use the Attribute bindings on the attribute vop. Then inside the attrib vop I just use a bind export vop to export out a matching vex parameter

Rob

Attachments:
attrib_binding.hip (126.9 KB)

Gone fishing
User Avatar
Member
118 posts
Joined: Feb. 2016
Offline
hello thanks a lot for the help,

but I've have a slightly more complex situation: I need to create automatically more than 1 group, without manually specifying the value.
The attrib vop should run over all the points, assigning the currently evaluating point to a new group if it finds a different value in @myattribute

I was thinking of some nested loop solution, but I'm not quite sure it's the way to go, seems too much overkill for such a basic need.
Edited by Andr1 - July 7, 2016 07:14:42
User Avatar
Member
182 posts
Joined: April 2009
Online
that's what the partition sop is for.
you can use a rule like this:
mygroup_`@att`
where mygroup_ can be any string and `@att` will be replaced by the attribute value.
or if your attribute is a float and you need to round it to an integer with rint() :
mygroup_`rint(@att)`
>
mygroup_1
mygroup_12
etc.

you can, of course, have more complex rules with more attributes like
mygroup_`@att`_`rint(@v_att.x)`__`rint(@v_att2.z)`-something
>
mygroup_1_4__16-something
mygroup_2_15__55-something
etc.
User Avatar
Member
4 posts
Joined: Oct. 2010
Offline
blackpixel
that's what the partition sop is for.
you can use a rule like this:
mygroup_`@att`
where mygroup_ can be any string and `@att` will be replaced by the attribute value.
or if your attribute is a float and you need to round it to an integer with rint() :
mygroup_`rint(@att)`
>
mygroup_1
mygroup_12
etc.

you can, of course, have more complex rules with more attributes like
mygroup_`@att`_`rint(@v_att.x)`__`rint(@v_att2.z)`-something
>
mygroup_1_4__16-something
mygroup_2_15__55-something
etc.
Thank you so much. it's work!!
User Avatar
Member
899 posts
Joined: Feb. 2016
Offline
well, thanks for the grave-dig, I totally missed the reply back then.
And thanks blackpixel (3 years later)
  • Quick Links