MENOZ Posted November 8, 2013 Share Posted November 8, 2013 hello, is there any example somewhere on how to use add piont, add prim, set attribute VOPS ? thank you Quote Link to comment Share on other sites More sharing options...
magneto Posted November 9, 2013 Share Posted November 9, 2013 (edited) 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 spaceint cc = addprim(geoself(), "polyline");addvertex(geoself(), cc, aa);addvertex(geoself(), cc, bb);[/CODE] Edited November 18, 2013 by magneto 1 Quote Link to comment Share on other sites More sharing options...
hyperforce Posted November 10, 2013 Share Posted November 10, 2013 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. Quote Link to comment Share on other sites More sharing options...
tjeeds Posted November 14, 2013 Share Posted November 14, 2013 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 Quote Link to comment Share on other sites More sharing options...
whythisname Posted November 16, 2013 Share Posted November 16, 2013 (edited) 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 November 16, 2013 by whythisname Quote Link to comment Share on other sites More sharing options...
magneto Posted November 16, 2013 Share Posted November 16, 2013 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 Quote Link to comment Share on other sites More sharing options...
whythisname Posted November 17, 2013 Share Posted November 17, 2013 (edited) 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 I guess I was so focused on the vertices and points that I never considered to look in the prim options Edited November 17, 2013 by whythisname 1 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.