Jump to content
Wout

Looping over Groups with only Points

Recommended Posts

Hi,

here's what I've done with vex so far working on a point cloud : Created groups based on clusters/distance

What I'd like to now is to be able to do stuff to those individual groups. With a for each /loop or something. Buuuut as there are only points, the promote group sop( set to point  -> primitives )  creates prim groups but empty ones. So I can't use that in a for loop

Any ideas ?

Thank You. 

 

Wout

Share this post


Link to post
Share on other sites

You can use the cluster id as a piece attribute in the foreach network, and then run over points.

Share this post


Link to post
Share on other sites

Hi ThomasPara, thanks. Maybe a little confusing but when I said cluster, I  didn't know about the actual cluster SOP. So I have  a point cloud with Point Groups assigned with Vex in an Point Wrangle. And I'd like to "split" or separate the groups , do stuff to those individual streams and merge them back together.

 

Thank you :)

Share this post


Link to post
Share on other sites

I hope I understand this correctly. There's 2 things you could do:

1) Don't use groups, attributes are superior in most cases. Instead of creating groups, create an integer or string attribute and use that as Piece Attribute on the loop, like ThomasPara suggested.

2) The name SOP can build names from groups, from there it's the same as 1)

Iirc the old foreach subnet had the option to run over groups, the new ones does not.

Share this post


Link to post
Share on other sites

OKay I just tried this and it worked:

 

Point wrangle 

Run over " detail ( only once)

//////////////////////////////////////////////////////////////////////////////////////////////////

int ptCount = detailintrinsic(0, "pointcount"); 

int counter = 0;

 

for(int i=0; i<ptCount; i++)
{

if(ENTER CONDITION FOR GROUPING HERE) counter+=1;

groupName = sprintf("group_%d", counter); 

"setpointattrib(0, "groupName", i, groupName);

}

//////////////////////////////////////////////////////////////////////////////////////////////////

in my vex and then used "groupName" as piece attribute.

 

Man I've been looking all night for that, literally :)

Edited by Wout

Share this post


Link to post
Share on other sites

Hey 3dome,

I tried 2) but couldn't get it to work with Names

 

Anyway thank you guys !

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×