vex: how to insert a variable into @attribute_name?
1269
2
2
Nuuk
Member
24 posts
Joined: April 2020
Offline
June 6, 2022 6:06 a.m.
Like this:
for (int i =0 ; i <4 ; i ++)
{
i@P ` i ` = i ;
}
Im trying to create multiple detail attributes like @P0/@P1/@P2/... Tried multiple expressions but all only output a single @Pi..
Any way to achieve that? Thanks!
Edited by Nuuk - June 6, 2022 07:59:55
tachbek
Member
43 posts
Joined: Feb. 2017
Offline
June 6, 2022 7:50 a.m.
for (int i =0 ; i <4 ; i ++)
{
string name = "P" + itoa (i );
setdetailattrib (0 , name , i , "set" );
//setdetailattrib(0, name, i);
}
this [
www.sidefx.com ].
Edited by tachbek - June 6, 2022 07:54:22
Andr
Member
900 posts
Joined: Feb. 2016
Offline
June 6, 2022 8:04 a.m.
Hello, check the attached example file and see if it works for you. As far as I know the most performant way to dynamically create attributes is to use an Attribute Create inside a feedback loop block. I never checked python based solution, however.
Edited by Andr - June 6, 2022 08:11:32
Attachments:
attrib_vec_performance.hiplc (151.8 KB)