Blacklisted_Guy Posted May 12, 2016 Share Posted May 12, 2016 So I recently started using vex and I needed to add an attribute. I tried using this:int count= neighbourcount("0", @ptnum); setpointattrib(0, "ncount", @ptnum, count); I added an attribute called "ncount" in a attribute create before hand. another thing I tried was this:int count= neighbourcount("0", @ptnum); addattrib(geoself(), point, "ncount", count); didn't work either. Anyone know what the problem could be? Quote Link to comment Share on other sites More sharing options...
Atom Posted May 12, 2016 Share Posted May 12, 2016 (edited) Maybe in the attribute create node you created ncount in the Primitive context, not the Point context (examine success in the Geometry spreadsheet)? Try creating it in the vex node like so. i@ncount = 0; Then follow up with the rest of your code. Edited May 12, 2016 by Atom Quote Link to comment Share on other sites More sharing options...
Blacklisted_Guy Posted May 12, 2016 Author Share Posted May 12, 2016 4 minutes ago, Atom said: Maybe in the attribute create node you created ncount in the Primitive context, not the Point context (examine success in the Geometry spreadsheet)? Try creating it in the vex node like so. i@ncount = 0; Then follow up with the rest of your code. It did create the attribute. For some reason the value remains 0 though Quote Link to comment Share on other sites More sharing options...
Blacklisted_Guy Posted May 12, 2016 Author Share Posted May 12, 2016 Here's the file I'm currently working on ptwrangleTest.hipnc Quote Link to comment Share on other sites More sharing options...
bonsak Posted May 12, 2016 Share Posted May 12, 2016 If your Wranlge node is running over points, you don't need to use "setpointattribute". You can just assign the value directly like this: int count = neighbourcount(0, @ptnum); @ncount = count; -b 1 Quote Link to comment Share on other sites More sharing options...
Blacklisted_Guy Posted May 12, 2016 Author Share Posted May 12, 2016 6 minutes ago, bonsak said: If your Wranlge node is running over points, you don't need to use "setpointattribute". You can just assign the value directly like this: int count = neighbourcount(0, @ptnum); @ncount = count; -b That worked! Thank you so much! Quote Link to comment Share on other sites More sharing options...
mawi Posted May 12, 2016 Share Posted May 12, 2016 i@ncount = 0; int count= neighbourcount("0", @ptnum); setpointattrib(0, "ncount", @ptnum, count); Your code could work if you killed the "" in neighbourcount("0",@ptnum); 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.