CinnamonMetal Posted February 19, 2020 Share Posted February 19, 2020 I have a string attribute which is referencing a parameter from the groupRename sop. This string attribute is a detail attribute; problem is getting only the primitives for the group in a integer attribute. I tried, although a little silly; the following in the same detail attribute; i@udim01 = atoi("udim_01"); obviously no success. Therefore I tried placing the same line in another primitive wrangler, the results are empty. How can I get only the primitives which belong to the group from the group Name parameter as an integer attribute for primitives ? Quote Link to comment Share on other sites More sharing options...
Noobini Posted February 19, 2020 Share Posted February 19, 2020 (edited) solution here: (I just modified 1 line) ...here's a mock up file, you'll see every 4 prims is grouped together...then an int attrib is created for each prim (you can reenable the Cd line to visualise if you want) vu_udim.hiplc Edited February 19, 2020 by Noobini Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted February 19, 2020 Author Share Posted February 19, 2020 I read the thread, therefore shouldn't the following give me an array of all the primitives in GroupZero ? string grp_01 = detailintrinsic(0,"GroupZero"); s[]@primGrp = {}; foreach(string grp01;grp_01){ if(inprimgroup(0,grp01,@numprim)) append(s[]@primGrp,grp_01); } Quote Link to comment Share on other sites More sharing options...
Noobini Posted February 19, 2020 Share Posted February 19, 2020 (edited) 40 minutes ago, CinnamonMetal said: I read the thread, therefore shouldn't the following give me an array of all the primitives in GroupZero ? string grp_01 = detailintrinsic(0,"GroupZero"); s[]@primGrp = {}; foreach(string grp01;grp_01){ if(inprimgroup(0,grp01,@numprim)) append(s[]@primGrp,grp_01); } dunno....but shouldn't you use expandprimgroup ? int [] expandprimgroup(<geometry>geometry, string groupname) btw, I think you should appending a 'number' to the array (ie. point index)...right now it looks like you're appending a string....but try expandprimgroup. Edited February 19, 2020 by Noobini Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted February 20, 2020 Author Share Posted February 20, 2020 6 hours ago, Noobini said: btw, I think you should appending a 'number' to the array (ie. point index)...right now it looks like you're appending a string if(inprimgroup(0,grp01,@numprim)) append(i[]@primGrp,grp_01); ? Also expandprimgroup() does work; but want to know otherwise. Quote Link to comment Share on other sites More sharing options...
Noobini Posted February 20, 2020 Share Posted February 20, 2020 3 minutes ago, CinnamonMetal said: if(inprimgroup(0,grp01,@numprim)) append(i[]@primGrp,grp_01); ? Also expandprimgroup() does work; but want to know otherwise. nah....the number...which is the same number that you tested for in inprimgroup so if you're testing inprimgroup(0,grp01,123) ie. you testing if prim number 123 is in a certain group, then add the number 123 to your array so you should be using @numprim Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted February 20, 2020 Author Share Posted February 20, 2020 Besides changing the string to an integer, I originally did use @numprim attribute in a previous post. Quote Link to comment Share on other sites More sharing options...
Noobini Posted February 20, 2020 Share Posted February 20, 2020 your append append(i[]@primGrp,grp_01) I see is grp_01 all in prev posts...... you gotta add the @numprim to the array...NOT the string grp_01 append(i[]@primGrp,@numprim) Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted February 22, 2020 Author Share Posted February 22, 2020 I've been trying to solve why I'm getting an error ? foreach(string grp01;grp_01){ if(inprimgroup(0,grp01,"grp_01")) append(i@[]primGrp,@numprim); 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.