jhiggins Posted June 1, 2005 Share Posted June 1, 2005 this is my first post ... so here i go!! How do I get the resolution ( Rows, Columns) as well as the Size of a Grid SOP from a custom SOP that has the Grid connected to it as its input? i hope that made sense!! jeff Quote Link to comment Share on other sites More sharing options...
grasshopper Posted June 1, 2005 Share Posted June 1, 2005 If I understand you correctly you would use opinputpath to get the full path to the node plugged into whichever input and then wrap a channel reference around it to get the value you want. For example if your grid was plugged into the first input you could get the four values you want with these expressions: ch(opinputpath(".",0)/rows) ch(opinputpath(".",0)/cols) ch(opinputpath(".",0)/sizex) ch(opinputpath(".",0)/sizey) Inputs are numbered from 0 so if your grid is plugged into the second input you would use ch(opinputpath(".",1)/rows) : etc - john Quote Link to comment Share on other sites More sharing options...
jhiggins Posted June 1, 2005 Author Share Posted June 1, 2005 If I understand you correctly you would use opinputpath to get the full path to the node plugged into whichever input and then wrap a channel reference around it to get the value you want. For example if your grid was plugged into the first input you could get the four values you want with these expressions: ch(opinputpath(".",0)/rows) ch(opinputpath(".",0)/cols) ch(opinputpath(".",0)/sizex) ch(opinputpath(".",0)/sizey) Inputs are numbered from 0 so if your grid is plugged into the second input you would use ch(opinputpath(".",1)/rows) : etc - john 18522[/snapback] Sorry... i should have been more specfic. I'm looking to exactly that, however, from within the HDK! Right now my setup is such that i have the parameters duplicated in my custom SOP, and your solution works great to reference the parameters on my custom SOP. What would be nice is to eliminate those duplicated parameters from my custom SOP and just get at them directly... and thats where I'm stuck!! Quote Link to comment Share on other sites More sharing options...
George Posted June 2, 2005 Share Posted June 2, 2005 Sorry... i should have been more specfic. I'm looking to exactly that, however, from within the HDK! 18525[/snapback] After you do a duplicateSource() in cookMySop(), the gdp pointer will contain the geometry from your input (whichever one you specify in duplicateSource()). From your gdp, you have several ways to get at this information. If the input Grid is a mesh type (e.g. mesh, NURBS surface, etc...) you're in luck, you can call GEO_Hull::getNumRows(), getNumCols() on each of the mesh primitives (if the direct input is a Grid SOP, then there'll only be one). Now if your Grid is generating polygons, you have a harder problem. Basically, the polygons are stored as individuals, each referencing several points, which are stored in a linear array. So the information about whether or not they are arranged in a grid pattern (and how many grids they form) is not immediately available. The GQ library offers a winged-edge type structure which can be used to determine such things as connectivity and order, but my guess is that is overkill. Hope that helps. George. Quote Link to comment Share on other sites More sharing options...
jhiggins Posted June 3, 2005 Author Share Posted June 3, 2005 Hope that helps. Thanks George... that certainly did the trick!! Quote Link to comment Share on other sites More sharing options...
jhiggins Posted June 3, 2005 Author Share Posted June 3, 2005 Thanks George... that certainly did the trick!! 18545[/snapback] hmm... well... i'm getting the rows and cols just fine. but my custom SOP needs to know the Size( sizex, sizey) of the Grid as well. How do I go about getting at those values? jeff Quote Link to comment Share on other sites More sharing options...
Jason Posted June 3, 2005 Share Posted June 3, 2005 hmm... well... i'm getting the rows and cols just fine.but my custom SOP needs to know the Size( sizex, sizey) of the Grid as well. How do I go about getting at those values? jeff 18547[/snapback] You're probably going to have to climb the tree and extract the parameters, probably. I'll see if I can find some code from a SOP of ours that does it. Quote Link to comment Share on other sites More sharing options...
George Posted June 5, 2005 Share Posted June 5, 2005 ...but my custom SOP needs to know the Size( sizex, sizey) of the Grid as well. How do I go about getting at those values? 18547[/snapback] On your GEO_Hull primitive, you can call prim->getBBox(&bbox) to get the bounding box of the grid. From there you should be able to figure out sizex and sizey. Take care, George. Quote Link to comment Share on other sites More sharing options...
jhiggins Posted August 17, 2005 Author Share Posted August 17, 2005 On your GEO_Hull primitive, you can call prim->getBBox(&bbox) to get the bounding box of the grid. From there you should be able to figure out sizex and sizey.Take care, George. 18562[/snapback] sorry the late reply, i just wanted to thank you for the solution so thanks!! jeff 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.