Does the Copy SOP not propagate groups?

   1606   4   2
User Avatar
Member
271 posts
Joined: March 2012
Offline
Hi all,
I feel like I'm missing something rather obvious here, but I can't seem to find a way to get the copy SOP to put the copied geometry into the same group that the copy point was in. Is this possible?
User Avatar
Member
453 posts
Joined: Feb. 2013
Offline
Turn your groups into attributes before you copy. Make sure the attribute gets transferred by the copy node and then group based on the attribute.
User Avatar
Member
271 posts
Joined: March 2012
Offline
DASD
Turn your groups into attributes before you copy. Make sure the attribute gets transferred by the copy node and then group based on the attribute.

Hi DASD,
I did think about that, but then just thought that this seemed simple enough that there must be an option for it on the copy SOP. If the template point is in a group…then place copied geometry into that group.
I'll send in a request to SideFX to add the option.

In the meantime I used a wrangle node. I had to add a string parameter (called pt_groups) to the wangle node to get access to the pointgrouplist expression, which doesn't seem to be available in VEX.

//Iterate over groups
// Find all points in the group from input 1
// For each point
// Find it's id
// Find all points with that id from input 0
// For each found point
// Set it's group to current iterating group
int ptnumf,
id,
idcount;
foreach(string group; split(chs(“pt_groups”))){
foreach( int ptnumg; expandpointgroup(1, group)){
id = point(1, “id”, ptnumg);
if(id==-1) continue;
idcount = findattribvalcount(0, “point”, “id”, id);
for(int i=0; i<idcount; i++){
ptnumf = findattribval(0, “point”, “id”, id, i);
setpointgroup(0, group, ptnumf, 1, “set”);
}
}
}

It seems to work, although the nesteed foreach seems to cause the compiler some headaches regarding the iteration variable.
User Avatar
Member
453 posts
Joined: Feb. 2013
Offline
Nice! Thanks for sharing your code!
User Avatar
Member
271 posts
Joined: March 2012
Offline
No problem! It can probably be simpler, as I have to use an id attribute (as my point count changes). It can probably be done by stamping the point number and using that instead of the id.
  • Quick Links