chiess Posted May 31, 2013 Share Posted May 31, 2013 (edited) Hi, I am not sure if this is the correct forum to ask such question, but can someone explain me following expression please: ( $PT >= ch("../grid1/cols") ) && ( $PT < ( ch("../grid1/cols") * ( ch("../grid1/rows")-1) ) ) It is used in an AttribCreate node as Value. Am I right, that the outcome is a boolean and basically ends as either 0 or 1 as Value. First boolean calc: If pointnumber is greater or equal to the grid1 column number = 1 Second boolean calc: If pointnumber is smaller than the columns multiplied with the rows-1 = 1 If both statements are true, return 1, else 0 So, basically I can translate the expression, but I am not sure if I understand the purpose behind it or how it affects the grid. It is probably hard to tell without any context. Lets say, the result is a color change on the grid points, calculated/animated by that expression. Any hints would be helpful, thanks! EDIT 1: Another question: Is it possible to have a loop in an hscript expression? For example, I want to change the color of all inner points of a grid. With the expression of my original post, I got the points of the first row and last row, but how do I get the points of the first column and last column now? I was thinking of using $PT != $PT*ch("../grid1/rows") There are 2 problems with that one: 1. it doesn't really work, nothing changes?! Is it a bug or something wrong in my calculation? When the pointnumber is 5 and I have 10 rows, it should result in 50, right? But the point 50 still has the same color 2. how can I run a loop on that expression, so it only works for an n-amount of times? I think I am missing something here - a big logical flaw in my brain at the moment Thanks, chiess Edited June 2, 2013 by chiess Quote Link to comment Share on other sites More sharing options...
WesleyE Posted May 31, 2013 Share Posted May 31, 2013 (edited) This is true when the point is higher than the first row AND when the point is lower than the points in the last row. Basically this expression skips the first and last row of the grid. Since the point number begins at 0 and not 1, the first expression is >= rather than > because the columns start at 1. Edited May 31, 2013 by WesleyE Quote Link to comment Share on other sites More sharing options...
chiess Posted May 31, 2013 Author Share Posted May 31, 2013 Thanks a lot WesleyE, that makes totally sense! Quote Link to comment Share on other sites More sharing options...
chiess Posted June 2, 2013 Author Share Posted June 2, 2013 New question in original post - Edit 1 Thanks guys! Quote Link to comment Share on other sites More sharing options...
anim Posted June 2, 2013 Share Posted June 2, 2013 $PT != $PT*ch("../grid1/rows") is 0 only if $PT is 0 otherwise it is 1 (assuming grid1 has more than 1 row) so for sure not a correct expression to get only first and last column you need to use something like 0 == $PT%ch("../grid1/cols") || (ch("../grid1/cols")-1) == $PT%ch("../grid1/cols")[/CODE]or if you want to just color inside points (ignore border points)then just create point or edge group with Edges/Unshared Edges option in Group SOP and forget all expressions(to get inside points you need to invert unshared edges group in Combine tab of course) Quote Link to comment Share on other sites More sharing options...
chiess Posted June 2, 2013 Author Share Posted June 2, 2013 Hi anim, Thanks, your expression works perfectly fine! Hmmm, yea, I can see my complete fail in my expression - I probably lost my mind/brain somewhere in the past two years... Thanks! 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.