jhcl21 Posted July 16, 2017 Share Posted July 16, 2017 Hi, I'm learning Houdini expression. Probably this is not the smarter way but for learning purpose. The network is simple, a grid and connected a delete sop after the grid sop. I want to delete every each other faces of the grid to make checker board pattern with an expression. Expression is: ($PR%(ch("../grid1/rows")-1) +$PR/(ch("../grid1/cols")-1))%2 The result is looks working for half of the grid but another half potion is disappeared. It was the same result on H15.5.56 and 16.0.55. Possibly expression is wrong or missed some setting but I have no idea how to fix it. Please give me an advice. Thank you Quote Link to comment Share on other sites More sharing options...
Noobini Posted July 16, 2017 Share Posted July 16, 2017 (edited) this ? (or delete NON selected..whatever suits your purpose) (the 2 is every 2nd.....3 would be every third....and so on) hmm....if you have even number of columns...needs a bit more thinking... Edited July 16, 2017 by Noobini Quote Link to comment Share on other sites More sharing options...
adrianr Posted July 16, 2017 Share Posted July 16, 2017 Switch sop evaluating based on the number of columns % 2 will let you use a sort sop to cover that. Have put in the Delete sop with Delete by range and a prim wrangle version to do the same thing. checkerboard_01.hip Quote Link to comment Share on other sites More sharing options...
jhcl21 Posted July 16, 2017 Author Share Posted July 16, 2017 Hi Noobini Thank you for replay. It looks very simple and I didn't know such way. Definitely, I will learn that way next and I appreciate you sharing your idea. But I'm trying to make an expression for any numbers of columns(EVEN number and ODD number ). Quote Link to comment Share on other sites More sharing options...
Noobini Posted July 16, 2017 Share Posted July 16, 2017 here's for EVEN cols.... (there's gotta be a generalised solution for either odd or even...beside using sort as adrianr has pointed out) Quote Link to comment Share on other sites More sharing options...
jhcl21 Posted July 16, 2017 Author Share Posted July 16, 2017 Hi adrianr Thank you for the file. I'm sorry for late response but it took a little time to understand (I'm still new in Houdini, also) I haven't thought such way to use sort1 and switch. It is the good way to use Switching. I had open your file and set the same number of rows and columns. It wokrs Rows(and Columns) are 4,6,8.. but not works 3,5,7... . I'd like to make it works for any numbers of rows(and columns). (I should explain this at 1st.) thank you. Quote Link to comment Share on other sites More sharing options...
jhcl21 Posted July 16, 2017 Author Share Posted July 16, 2017 Noobini I think I have not miss typed your expression in my network. but it looks work sometimes, not works sometimes. Please check the attached image. thanks! Quote Link to comment Share on other sites More sharing options...
Noobini Posted July 16, 2017 Share Posted July 16, 2017 yes I did say for EVEN cols only...(bear in mind houdini terminology deosn't help here...Grid columns are actually 'lines'...not a 'block'...so when the grid has 8 columns...it is 7 blocks....so when I say EVEN columns....I meant BLOCKS...you know what I meant...) Quote Link to comment Share on other sites More sharing options...
jhcl21 Posted July 16, 2017 Author Share Posted July 16, 2017 Oh, sorry I miss understood that line and understand it now. I will try that you mentioned which is use sort. I understand the EVEN Cols terms. thank you! Quote Link to comment Share on other sites More sharing options...
Noobini Posted July 16, 2017 Share Posted July 16, 2017 (edited) here you are....works for ALL cases. Confession: I have no idea why this works....it just does !!!!!!! (ie. why does it work with ptnum...when I expected elemnum to work ?!?!?!?! NFI !!!) vu_Checkerboard.hipnc Edited July 16, 2017 by Noobini Quote Link to comment Share on other sites More sharing options...
jhcl21 Posted July 16, 2017 Author Share Posted July 16, 2017 Wow Its Great! Thank you for the file. I'm not fully understand that yet at this moment. but Studying your expression. thanks again. Quote Link to comment Share on other sites More sharing options...
Noobini Posted July 16, 2017 Share Posted July 16, 2017 here's one even simpler...just the Delete... (no, I don't know the mystery of why ptnum works...) 1 Quote Link to comment Share on other sites More sharing options...
Noobini Posted July 16, 2017 Share Posted July 16, 2017 for checkerboard Group selection 1 Quote Link to comment Share on other sites More sharing options...
jhcl21 Posted July 17, 2017 Author Share Posted July 17, 2017 Noobini Thank you for keep thinking about it. It's very simple that I had tried at the beginning. @ptnum is working for delete Primitives. I appreciate that your help! Quote Link to comment Share on other sites More sharing options...
Noobini Posted July 17, 2017 Share Posted July 17, 2017 finally......If I can't demystify why ptnum works...I'll get rid of it.... Here's one where I insist on using primnum only...yes it's longer...but there's no 'mystery' about it (now if I apply the same logic to the Group expression...it doesn't require the Int/Floor...interesting) vu_Checkerboard3.hipnc 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.