Welcome to od|forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

MENOZ

add point vop H13

hello, is there any example somewhere on how to use add piont, add prim, set attribute VOPS ?

thank you

Share this post


Link to post
Share on other sites

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
1 person likes this

Share this post


Link to post
Share on other sites

So far I've only seen these new functions in their pure VEX form inside wrangle nodes.

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

Share this post


Link to post
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.

1 person likes this

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Creating closed polygons is also easy. You have to specify "poly" for the last argument of addprim. I haven't used the VOP versions though. I am talking about VEX :)

1 person likes this

Share this post


Link to post
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
1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now