WaldoB Posted August 28, 2013 Share Posted August 28, 2013 With the delete/copy node combination, I want to loop over each group of the input separately and combine the results at the end. This is the input node: As you see, it has two primitive groups. In the delete node where this node flows into, I'd like to delete all groups except for the "current one". Basically, I'm looking for the HScript string expression that returns a group name by index. Something like this: primgrouplist("../all_junctions")[0] Off course this doesn't work, because that just returns the first letter of the string returned by primgrouplist. How do I return thenth group in primgrouplist? Thanks, Waldo Quote Link to comment Share on other sites More sharing options...
Robert Posted August 28, 2013 Share Posted August 28, 2013 Hi, you can use a copy node with primgrouplist("../all_junctions") as the number of copies. Turn on stamping and create a variable (I usually call it "copy") and give it the value of $CY. In the delete, or blast, node you can use group`stamp("../copy1","copy",0)` to get each different group. For a preview you can change the 0 (the index). 1 Quote Link to comment Share on other sites More sharing options...
Annon Posted August 28, 2013 Share Posted August 28, 2013 Can you not do this in the ForEachSOP? Quote Link to comment Share on other sites More sharing options...
WaldoB Posted August 28, 2013 Author Share Posted August 28, 2013 Thanks for your reply Robert. That is what I had initially tried, but the problem with that is I have to assume what the incoming group names are. I need it to work with arbitrary group names. ChristianW: possibly, can you show me how? Quote Link to comment Share on other sites More sharing options...
Annon Posted August 28, 2013 Share Posted August 28, 2013 Sure. Have a look at this, it's a forEach that is working on anything with "sphere_#" in it's group name. od_forEach.hip Quote Link to comment Share on other sites More sharing options...
yongbin Posted August 28, 2013 Share Posted August 28, 2013 I think you need arg(somestringlist, 0) 2 Quote Link to comment Share on other sites More sharing options...
WaldoB Posted August 28, 2013 Author Share Posted August 28, 2013 yongbin: that's exactly it! Thanks a lot! Christian: while that's a good suggestion, it has the same issue I explained in my previous comment. Quote Link to comment Share on other sites More sharing options...
Annon Posted August 28, 2013 Share Posted August 28, 2013 So you're going to have groups coming in like "fizz01, twozz15, wipple236"? Not "fizz01, 02, 03, 04" etc... What exactly are you trying to do? Because forgetting what you called them in groups previously, you could do a connectivity and partition for the forEach to iterate over every object and do something on each object inside of the forEach. Quote Link to comment Share on other sites More sharing options...
WaldoB Posted August 28, 2013 Author Share Posted August 28, 2013 Yes, I cannot assume any incoming group name. The connectivity/partition method works too, but that changes the group names. I need to preserve group names. Yongbin's suggestion solves my problem, because I can get the groupname by index or in your case the FORIDXVALUE. Thanks both of you for the suggestions! Quote Link to comment Share on other sites More sharing options...
Robert Posted August 28, 2013 Share Posted August 28, 2013 I made a mistake in my first post. For the delete copy method you need to also use the argc() expression so it becomes argc(primgrouplist("../all_junctions")) instead of just primgrouplist("../all_junctions"). Still doesn't give you the ability to use random group names though 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.