Wout Posted October 28, 2019 Share Posted October 28, 2019 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 Quote Link to comment Share on other sites More sharing options...
ThomasPara Posted October 28, 2019 Share Posted October 28, 2019 You can use the cluster id as a piece attribute in the foreach network, and then run over points. Quote Link to comment Share on other sites More sharing options...
Wout Posted October 28, 2019 Author Share Posted October 28, 2019 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 Quote Link to comment Share on other sites More sharing options...
3dome Posted October 28, 2019 Share Posted October 28, 2019 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. Quote Link to comment Share on other sites More sharing options...
Wout Posted October 28, 2019 Author Share Posted October 28, 2019 (edited) 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 October 28, 2019 by Wout Quote Link to comment Share on other sites More sharing options...
Wout Posted October 28, 2019 Author Share Posted October 28, 2019 Hey 3dome, I tried 2) but couldn't get it to work with Names Anyway thank you guys ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.