Arthur Spooner Posted March 21, 2016 Share Posted March 21, 2016 I want to return the number of vertices for a cube, I just know there is more code missing @cr = int nvertices('box1'); I get an error that it's expecting a semicolon, I placed a semicolon ? Quote Link to comment Share on other sites More sharing options...
anim Posted March 21, 2016 Share Posted March 21, 2016 (edited) if the cube is connected to let's say first input it would be i@cr = nvertices(0); if it's not connected, but lives at the same level then i@cr = nvertices("op:../box1"); Edited March 21, 2016 by anim Quote Link to comment Share on other sites More sharing options...
Arthur Spooner Posted March 22, 2016 Author Share Posted March 22, 2016 (edited) if the cube is connected to let's say first input it would be i@cr = nvertices(0); if it's not connected, but lives at the same level then i@cr = nvertices("op:../box1"); Ahh declare an integer for the variable, couldn't int nverticies, do the same thing ? Edited March 23, 2016 by Arthur Spooner Quote Link to comment Share on other sites More sharing options...
Arthur Spooner Posted March 23, 2016 Author Share Posted March 23, 2016 Is there a debug window where I can see the results of the nvertices command ? I was expecting to be informed of the number of points on the mesh ? Quote Link to comment Share on other sites More sharing options...
anim Posted March 25, 2016 Share Posted March 25, 2016 well, regardless of the VEX snippet, to find out the statistics about geometry of any SOP you can jsut middle click and hold on it if you want to actually see the result of the function you can assign it to an attribute and see it in Geometry Spreadsheet (RMB/Spreadsheet...) i@nvtx = nvertices(0); will create integer attribute nvtx which will contain number of vertices of the first geometry and it depends on Wrangle type which attribute it will be (Point, Vertex, Primitive, Detail) then you either see it in Geometry Spreadsheet or create visualizer in viewport and be aware that vertices and points are not the same thing, so if you want points use npoints() function Quote Link to comment Share on other sites More sharing options...
Arthur Spooner Posted March 28, 2016 Author Share Posted March 28, 2016 This is my VEX code, is this how it should be written in wrangler ? i@cr = nvertices("op:../box1"); i@nvtx = nvertices(0); I recall somewhat the Geometry Spreadsheet, how do I create a visualizer in the viewport ? Vertices and points are not one in the same; what is the difference ? In your previous message you wrote the following path, do you have any resources on how I can learn command such as op as you used in Houdini etc ? i@cr = nvertices("op:../box1"); Thanks. Quote Link to comment Share on other sites More sharing options...
mestela Posted March 28, 2016 Share Posted March 28, 2016 Points vs verticies: http://www.sidefx.com/docs/houdini15.0/model/attributes#geometry-components Quote Link to comment Share on other sites More sharing options...
anim Posted March 28, 2016 Share Posted March 28, 2016 I recall somewhat the Geometry Spreadsheet, how do I create a visualizer in the viewport ? http://www.sidefx.com/docs/houdini15.0/basics/visualizers#menu In your previous message you wrote the following path, do you have any resources on how I can learn command such as op as you used in Houdini etc ? http://www.sidefx.com/docs/houdini15.0/io/op_syntax Quote Link to comment Share on other sites More sharing options...
Arthur Spooner Posted March 28, 2016 Author Share Posted March 28, 2016 This is all wonderful but my question was overlooked For the following code to work; i@cr = nvertices("op:../box1"); i@nvtx = nvertices(0); I assume I have to create a visualizer ? Quote Link to comment Share on other sites More sharing options...
mestela Posted March 28, 2016 Share Posted March 28, 2016 (edited) No, just look at your geometry spreadsheet. Always have a geometry spreadsheet open. ALWAYS! If you set the wrangle to run in details mode, set the geo spreadsheet to detail. If you set it to point, look at points. Animated gif FTW: Yes, you can use a visualiser, it lets you take point/vertex/prim data and display it in the viewport as text/colour/vectors, but most of the time the geometry spreadsheet is less visual clutter, and keeps you thinking about the data your shunting around on your geometry. Edited March 28, 2016 by mestela Quote Link to comment Share on other sites More sharing options...
Arthur Spooner Posted March 28, 2016 Author Share Posted March 28, 2016 (edited) Does Vertex have more precedence over points ? I was reading the link mestela posted and that is what I understood, I'm probably wrong ? Vertex are sub-level of points ? Instead of using a file name, one can simply use op:<path> to the node ? Rather then (../../) you use (op:../) ? What kind of visualizer does one apply to a pointWrangler node, marker, color, volume or tag in my situation. I tried a marker node, and if that is the correct node visualizer, then I didn't do the right settings. Edited March 28, 2016 by Arthur Spooner Quote Link to comment Share on other sites More sharing options...
mestela Posted March 29, 2016 Share Posted March 29, 2016 More gifs! Seems to not work for detail attribs though, tried going to pure wireframe, marker mode, up to object level and back, no dice. You can see the value just fine in the geometry spreadsheet though... Quote Link to comment Share on other sites More sharing options...
Arthur Spooner Posted March 29, 2016 Author Share Posted March 29, 2016 Ohh the visualizer node, these gifs are quite helpful I was using the visualizer menu, now I see is just a toggle, make more sense. mestela - you wouldn't be able to help understand my other questions in my previous post ? Quote Link to comment Share on other sites More sharing options...
Arthur Spooner Posted March 29, 2016 Author Share Posted March 29, 2016 (edited) A cube doesn't contain 24 points, so for each corner of the cube visualizer is displaying 24, that has to do with vertex and points, correct ? ps - I understand your point about the Geo Spreadsheet graph, more options the better Edited March 29, 2016 by Arthur Spooner Quote Link to comment Share on other sites More sharing options...
mestela Posted March 29, 2016 Share Posted March 29, 2016 (edited) I can never remember which way the order of precedence goes, so I usually explicitly set whatever attributes I want at the level I want, and delete others. Eg, if I want point colour, I'll attribpromote from prim to point if that's where my existing colour is, delete prim colour, and continue on. Re point/vert/prim, it makes more sense if you think about how you'd construct shapes from 'nothing'. A point can be standalone, like a single particle in maya. Points can be linked together to form primitives, their linking structure is stored as vertices. Put down a platonic sold in tetrahedron mode, and look at the geometry spreadsheet for points, verts, prims. The points store positions. The vertex id on the far left column represents prim:vert. You can see there's 3 prims (0,1,2), and each prim has 3 verts, and each vert references 1 point. It makes more sense when you start creating your own primitives in wrangles. You take your points, add an empty primitive, then add verticies to the primitive that refernce points. Eg, say I had 3 points floating in space (with @ptnum's of 0, 1, 2), I could run this in a detail wrangle to connect them up into a triangle, by first creating the primitive, then adding verticies: int myprim = addprim(0, 'poly'); addvertex(0,myprim,0); addvertex(0,myprim,1); addvertex(0,myprim,2); Edited March 29, 2016 by mestela Quote Link to comment Share on other sites More sharing options...
mestela Posted March 29, 2016 Share Posted March 29, 2016 A cube doesn't contain 24 points, so for each corner of the cube visualizer is displaying 24, that has to do with vertex and points, correct ? ps - I understand your point about the Geo Spreadsheet graph, more options the better Each face contains 4 verts. You have 6 faces, so 6*4 = 24. Quote Link to comment Share on other sites More sharing options...
Arthur Spooner Posted March 29, 2016 Author Share Posted March 29, 2016 (edited) Put down a platonic sold in tetrahedron mode, and look at the geometry spreadsheet for points, verts, prims. The points store positions. The vertex id on the far left column represents prim:vert. You can see there's 3 prims (0,1,2), and each prim has 3 verts, and each vert references 1 point. When you said, vertix id on the far left column represents prim:vert, did you mean here ? Edited March 29, 2016 by Arthur Spooner Quote Link to comment Share on other sites More sharing options...
mestela Posted March 29, 2016 Share Posted March 29, 2016 no, thats primitives you're looking at. one to the left. Quote Link to comment Share on other sites More sharing options...
Arthur Spooner Posted March 29, 2016 Author Share Posted March 29, 2016 (edited) I assume it's normal that for my platonic, I'm seeing more then just 0,1,2 as in your screen shot; rather this: If so what does the 0:1, 0:2 etc represent ? Edited March 29, 2016 by Arthur Spooner Quote Link to comment Share on other sites More sharing options...
mestela Posted March 29, 2016 Share Posted March 29, 2016 prim:vertex to make it a little clearer I've switched to the dodecahedron primitive, and turned on point, vertex, prim numbering in the viewport (d hotkey in viewport, markers tab, enabled, point number, verticies number, prim number), that'll help you decipher whats going on. I've also set the font to large (hit d in the viewport, guides tab, guide font -> large), and by blasting faces in turn, can see the relationship between points, verts, prims. verts are local to each prim, so because each prim has 5 verts, the vertex numbers in the viewport only ever go 0-5. 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.