Welcome to od|forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

jhcl21

Expression for delete faces

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

2017-07-16_01h20_40.png

Share this post


Link to post
Share on other sites

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...

checkerboard.jpg

Edited by Noobini

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 ).

 

 

 

 

Share this post


Link to post
Share on other sites

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)

checkerboard_EvenCols.jpg

Share this post


Link to post
Share on other sites

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.

2017-07-16_03h03_17.png

Share this post


Link to post
Share on other sites

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!

 

 

2017-07-16_03h09_07.png

2017-07-16_03h12_50.png

Share this post


Link to post
Share on other sites

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...)

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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 by Noobini

Share this post


Link to post
Share on other sites

Wow Its Great!

Thank you for the file.

I'm not fully understand that yet at this moment.

but Studying your expression.

thanks again.

 

Share this post


Link to post
Share on other sites

here's one even simpler...just the Delete...

(no, I don't know the mystery of why ptnum works...)

Checkerboard2.jpg

1 person likes this

Share this post


Link to post
Share on other sites

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!

 

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now