Jump to content

add point vop H13


MENOZ

Recommended Posts

I don't know if there are VOP examples but you can create poly curves like this:


vector a = {0,0,0};
vector b = {0,2,0};
int aa = addpoint(geoself(), a);
int bb = addpoint(geoself(), b ); // forum uses wrong casing, so had to use a space
int cc = addprim(geoself(), "polyline");
addvertex(geoself(), cc, aa);
addvertex(geoself(), cc, bb);[/CODE]

Edited by magneto
  • Like 1
Link to comment
Share on other sites

Adding an attribute in VOPs should be as simple as an ADDATTRIB, or BIND VOP though.

It is that simple, assuming you're creating an attribute of the same class that you are iterating on. Also the Add Point/Set Attribute vops make things very easy, as opposed to writing the vex code.

  • Like 1
Link to comment
Share on other sites

I figured it out by looking at the the attrib wrangle in one of the "find shortest path" node examples. I recreated part of that attrib wrangle in an attrib vop by looking at the code. It's not too hard because pretty much all vex code (including the snippets in wrangles) also has vex nodes that do the same thing (that's the whole point of using the nodes in the first place, so you can build the code in a visual manner). So you might want to look into that example as well, it's the example file to demonstrate one way connections I believe and it's used to make a grid for the path finder (just check out the help for the "find shortest path" node, there are only 2 examples I think so it should be easy to find if you dig around a little).

One of the issues I ran into though was that those nodes are available in vop sops, but they don't work there because vop sops can't create geometry. So if you want to create geometry make sure you're using one of the networks that supports geometry creation (they're listed in the help of those nodes, the attrib vop is one of them but take a look in the help to make sure you're using a compatible network type).

In short though: you put down a primitive node (I'm not sure if it's necessary, I don't think it is), take the primnum that comes out of that and stick that into (a) point node(s) (this is not needed if you don't create a new prim, but it will assign the points to existing prims then, I think), and the point number(s) from that you stick into (a) vertex node(s). The prim node makes an empty primitive, the point node makes a point at the position you designate and the vertex node can create lines from point to point depending on what order they're executed (I think).

I'm not sure how to control the order in which the points/vertices are placed though (other than sticking 1 node in a while/for loop) and I'm not sure you can create closed polygons either (lines aren't an issue for me, but closed polygons I've not managed to figure out yet, if it's even possible).

Edited by whythisname
Link to comment
Share on other sites

Yeah I'm looking at the add prim node again and there is actually a "closed polygon" option, so I'm feeling like a bit of a dumbdumb here :P I guess I was so focused on the vertices and points that I never considered to look in the prim options :lol:

Edited by whythisname
  • Like 1
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...