grouping by string attr (prims)

   3724   3   0
User Avatar
Member
196 posts
Joined: 8月 2011
Offline
some times it's the little things ..


I have a geometry with many prims. each prim has an attr of the type string.

0 - A
1 - A
2 - B
3 - B
4 - A

Now I'd like to create a group called “A_group”, with all the according prims in it.

I can neither get the attr wrangle code to work or do I understand the new group expression node…

I'm sure it's super simple, but I'm lost and could not get this to work in 1.5 hours.


any input welcome!
m.
User Avatar
Member
8620 posts
Joined: 7月 2007
Offline
let's assume your attribute is called name

then you either append
- Partition SOP with rule set to:
${NAME}_group
OR
- Primitive Wrangle:
setprimgroup(0, s@name+"_group", @primnum, 1);
Edited by tamte - 2017年12月26日 12:32:00
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
196 posts
Joined: 8月 2011
Offline
thanks so much for this input!

the approach with the Partition SOP does not work for me. Even with upper case characters.

but the prim wrangle approach does work!

so I have a solution that get the job done.

thanks again!!
m.
User Avatar
Member
555 posts
Joined: 2月 2017
Offline
for Partition, i do:

rule: group_`@NAME`

(if you need some ‘tip’, simply use one of the rule presets, say…Group by Color, then you'll see its syntax….then you'd be able to figure out the syntax)
  • Quick Links