Iterate pointGroup by groupCount or trough list of groupName

   4527   5   0
User Avatar
Member
25 posts
Joined: Feb. 2010
Offline
Hi,
I'm trying to iterate on a bunch of points groups (using foreach).
“group2__0 group2__1 group2__2 group2__3 group2__4 group2__5 …”

I can get the list of all my groups with the pointgroupmask expression, but after that I don't know how I can count them or get them separately.

For the moment I'm able to get a string attribut with all my groups names separated by a space… but after that…

I don't necessarly need their names, I can iterate if I know the number of points groups

All the troubles cames from the fact that the foreach loop doesn't work with points groups… So I need to convert all my groups to primitives groups, but the group->edit->point to primitive doesn'at accept the * sign, and doesn't accept the list of strings returned by pointgroupmask…

So I think I need to count them in order to iterate the correct number of group… or iterate on each string returned by pointgroupmask but maybe it's more simple.

I hope you get some idea…
User Avatar
Member
678 posts
Joined: July 2005
Offline
Look for argc() expression.
User Avatar
Member
25 posts
Joined: Feb. 2010
Offline
Thank you Swann_, I get it to work with argc…

Maybe this is not the better way to iterate over point groups, but here is the solution I have for now

FOREACH number
1 -> argc( pointgroupmask(“../group2”, “group2*”))

with pointgroupmask, I get the list of all my groups and with argc, I get the number of groups in the list…

after that, I use
group2`stamp(“../../foreach1”,“FORVALUE”,0)-1` as the group name
to compute only for the specified group. The “-1” is used because my groups numbers started at 0.


I hope it can help peoples,
User Avatar
Member
1021 posts
Joined: April 2008
Offline
Hi,

I need a little help with this maybe you can give me.

I want to iterate just like that but instead of return the group numbering, I want to accumulate a value for each group on a attribute, like:

I have 5 groups so I would have an attribute lets say “grpnumber” accumulating a value of 1 for each group so the result would be “grpnumber = 1”, “grpnumber = 2” until “grpnumber=5”.

One problem is that my groups are not numbered they have different string names and I cant use foreach number because I have too many primitives lets say more than 2K.

I hope I could be clear.

Can you help me to do that?
https://vimeo.com/user2163076 [vimeo.com]
User Avatar
Member
519 posts
Joined:
Offline
Not exactly sure what you want but you could use an expression like this:

argc(primgrouplist“../path_to_node”))
User Avatar
Member
1021 posts
Joined: April 2008
Offline
Thanks you for the reply.

Sorry that I couldn't explain my question right.

I´ll try to resume better.

For example, I have 3 primitive groups:

group “wheel”
group “tire”
group “steer”

I also have a primitive attribute, lets say “accum”, that I want to accumulate a value of 1 for each group in a iteration of 3, so I would have something like that:

group “wheel” - accum == 1
group “tire” - accum == 2
group “steer” - accum ==3

I hope I could explain better this time

I´ll try to use the expression, but I don´t know exactly to use it to get what I want.

Thanks anyway.
https://vimeo.com/user2163076 [vimeo.com]
  • Quick Links