vex help: connect prims based off attribute?
2139
4
0
JasonSlab
Member
1535 posts
Joined: 3月 2020
オフライン
2019年2月17日 23:58
Hi guys/gals
I'm having some issues trying to figure our how to connect prims together, but only to connect from one prim to another based off an levels attribute, so, connect level0 > level1, level1 > level2 and so on. At the moment I still get connections between say level0 and level3.
Prob missing something simple here..
thx
J
Attachments:
connectme.jpg (48.6 KB)
tree_branch_connect_v02.hipnc (167.7 KB)
tamte
Member
9430 posts
Joined: 7月 2007
オフライン
2019年2月18日 0:28
run your point wrangle only on roots group
with this code:
float searchrad = chf ("Searchrad" );
string grp = sprintf ("\@level=" + itoa (i@level -1 ));
int nearpt = nearpoint (0 , grp , @P , searchrad );
if (nearpt != -1 ){
int myprim = addprim (0 , "polyline" , nearpt , @ptnum );
}
Tomas Slancik CG Supervisor Framestore, NY
JasonSlab
Member
1535 posts
Joined: 3月 2020
オフライン
2019年2月18日 2:31
Dam Tomas, works like a charm, thanks so much!
Just curious, what is the “\” for in the sprintf? seems to work without it..
I wish I could plug my brain into yours and suck our some of that knowledge!
J
tamte
Member
9430 posts
Joined: 7月 2007
オフライン
2019年2月18日 5:51
JasonSlab Just curious, what is the “\” for in the sprintf? seems to work without itit's just to escape the @ character, I recall it didn't use to work without it in the old versions, even though I'm not certain now
Tomas Slancik CG Supervisor Framestore, NY
JasonSlab
Member
1535 posts
Joined: 3月 2020
オフライン
2019年2月18日 7:30
O interesting. I will look into that. Thanks again.