Jump to content

ianwww

Members
  • Content count

    5
  • Donations

    0.00 CAD 
  • Joined

  • Last visited

Community Reputation

0 Neutral

About ianwww

  • Rank
    Peon

Personal Information

  • Name
    ianwww
  • Location
    Tasmania
  1. Change radius of sphere primitive in vex

    Brilliant - that did it! Thanks Konstantin. I would never have worked that out by myself...!
  2. I've created a sphere primitive in vex, using: centre_pt = addpoint(0, pos); sphere_prim = addprim(0, 'sphere', centre_pt); I want to be able to vary its size in the viewport but can't work out how to do it. When a sphere prim is added using a SOP, the sphere's size can be changed using scale (the Uniform scale slider). I thought that this vex would therefore do the same thing: setprimattrib(0, 'scale', sphere_prim, chf('sphere_size'), 'set'); but changing chf('sphere_size') has no effect on the sphere's size. (I've also tried replacing 'scale' with 'radius', and also with 'radx', 'rady' and 'radz'.) I've found this link cgwiki which explains how to do it for a prim that has multiple points but a sphere prim only has its single central point. How can I change a sphere prim's size in vex?
  3. Can @group_NAMEOFGROUP be a variable?

    Thanks for the suggestion but - and I may be misunderstanding something - in your example wouldn't if(@group_grp) and if(result) be asking the same thing? Both were manually set to 1 at the same time when condition was met, so result is just a mirror variable isn't it? Also, I'd still need to hard code the name of @group_grp in advance of knowing what the name should be. Sorry if I've misunderstood!
  4. In a point wrangle I create a new group, say mynewgroup, and set membership of it based on some criterion. Later in the wrangle I want to test for membership of that new group. I can't use inpointgroup because that looks backward to the previous node, where the newly created group doesn't exist. So, instead I use if(@group_mynewgroup) { WHATEVER } to test for a point's membership of the new group mynewgroup. To use @group_ syntax I need to hard code the mynewgroup into it. What if the name of the new group depends on the outcome of some code inside the wrangle so that I need to create the new group name on the fly? I'd like to be able to use something like string newgroup = concat('group_', 'mynewgroup'); if(@newgroup) { WHATEVER } I know this particular code doesn't do it but is there something along these lines that I could use?
  5. inpointgroup and npointsgroup aren't working for me (Indie 18.0.416). I have a grid with an attribute from map image. I manually select different areas of the grid and add those selections to various named groups. I then add a scatter node to generate scatter points over the grid. The scatter points appear to inherit the group memberships from the underlying areas of the grid - prior to the scatter node, the info popup shows the various group names as prim groups and in/after the scatter node the group names appear as point groups. I then run some code in a detail attribute wrangle to loop through a particular group's scatter points (those of a cypress tree in the image, group 'Cypress') to identify points lying along the boundary of that group (ie. the boundary of the cypress tree). I then add those boundary points to a group named 'Cypress_edge', using setpointgroup(0, 'Cypress_edge', pointNum, 1, 'set'); I can see in the geometry spreadsheet that this has worked - there are now points having membership in both the original group 'Cypress' (88,850 points) and the 'Cypress_edge' group (8,120 points). However, when I then check-test the boundary points for membership of the 'Cypress_edge' group using inpointgroup(0, edgegroupname, pointNum) they don't show membership (inpointgroup returns zero for every point). Also, if I ask how many points are in the 'Cypress_edge' group, using npointsgroup(0, edgegroupname) the answer is zero, even though there are 8,120 points in the geometry spreadsheet's 'Cypress_edge' column that have a value of 1. inpointgroup and npointsgroup work for the point groups that existed prior to the VEX wrangle but not for the 'Cypress_edge' group that was created inside the wrangle. I'd appreciate any advice about what I might be doing wrong! [SOLVED] I've finally realized that inpointgroup and npointsgroup are looking backwards at the preceding node (ie. through input 0), and there are no edge points yet in that previous node. So, while setpointgroup(0, 'Cypress_edge', pointNum, 1, 'set'); creates the group 'Cypress_edge' (on its first call) and sets its member points' include values to 1, I also need to set @group_Cypress_edge = true; to tell the local wrangle that the point is a member, and I also need to use if(@group_Cypress_edge) to test for membership locally. I'm not sure how to get the number of points in Cypress_edge using this method though, other than looping through all the points and doing a count. I also have some further questions about this method but I'll leave those for a separate post.
×