Jump to content
CinnamonMetal

Integer Attribute from Group Name

Recommended Posts

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 ?

Share this post


Link to post
Share on other sites

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 by Noobini

Share this post


Link to post
Share on other sites

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);
    }

 

Share this post


Link to post
Share on other sites
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 by Noobini

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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);

 

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

×