localstarlight Posted August 24, 2016 Share Posted August 24, 2016 I'm feeding a grid of primitives into a Foreach subnetwork, and I want to be able to place something (in this case move the centre of a bounding sphere for group definition) at the centre of each primitive. I feel like this should be simple, but I cannot figure out how to do it. Straight after the 'each1' node, I added an attribute wrangle which adds the centroid of the primitive as a detail attribute like this: v@centroid = prim(geoself(),"P",0); But then in the group node further down, I am trying to access this attribute for each of the X,Y and Z values of the Bounding -> Center channels, but cannot figure out how to access each of the X,Y and Z values of the attribute separately. I am trying to use this expression: detail("../attribwrangle3/","centroid",0) But it obviously only gives me the X value from the vector. I have tried: detail("../attribwrangle3/","centroid.x",0) detail("../attribwrangle3/","centroid[0]",0) detail("../attribwrangle3/","centroid",0).x ...and various other ways to access the different parts of the vector, but nothing seems to work and I can't find anything in the docs (or on the forums) about how this should be done. Or maybe I am going about this totally the wrong way in the first place?! Quote Link to comment Share on other sites More sharing options...
f1480187 Posted August 24, 2016 Share Posted August 24, 2016 At first, try just @-syntax, it might work in your case. If not, fallback to the expression function, but call it properly. The last number in detail expression function used to get the component of vector. # From first input, using @-syntax. @centroid.x @centroid.y @centroid.z # From any node, using index numbers. detail("../attribwrangle3/", "centroid", 0) detail("../attribwrangle3/", "centroid", 1) detail("../attribwrangle3/", "centroid", 2) # From any node, using enum-style constants. detail("../attribwrangle3/", "centroid", D_X) detail("../attribwrangle3/", "centroid", D_Y) detail("../attribwrangle3/", "centroid", D_Z) 1 Quote Link to comment Share on other sites More sharing options...
haggi Posted August 24, 2016 Share Posted August 24, 2016 (edited) vector v = detail("../attribwrangle3/","centroid",0) Gives me exact the vector which was added to the detail. Sorry, didn't read the question correctly, you are talking about expressions not vex. Edited August 24, 2016 by haggi error Quote Link to comment Share on other sites More sharing options...
3dome Posted August 24, 2016 Share Posted August 24, 2016 detail("../attribwrangle3", "centroid", 0) for x component detail("../attribwrangle3", "centroid", 1) for y component detail("../attribwrangle3", "centroid", 2) for z component 1 Quote Link to comment Share on other sites More sharing options...
localstarlight Posted August 24, 2016 Author Share Posted August 24, 2016 Ah! Thanks everyone! 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.