Jump to content

creating neighbour attribute


Blacklisted_Guy

Recommended Posts

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?

Link to comment
Share on other sites

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 by Atom
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...