Divide>Bricker .. switch if ODDS/PAIRS

   1596   4   1
User Avatar
Member
67 posts
Joined: 4月 2017
Offline
Hello guys,

need help with a conditional inside switch node.

I have a wall , sometimes with odd number of prims (3,5,7..) and other times pairs numbers (2,4,6..).

Depending that number the switcher must select the correct one (0 or 1).

I need the wall divisions to be CENTERED in the wall. With de RESAMPLE node it seems imposible.

¿¿What is the correct code to apply??
should something like this:
if(nprims('../reverse5')==0, 0, 1)

Thanks in advance.
Edited by bhb - 2023年1月10日 11:08:17

Attachments:
divide_odd_or_pairs.png (104.0 KB)

User Avatar
Member
144 posts
Joined: 8月 2012
Offline
You can use a bbox expression and a spare parameter in the Divide SOP's Size parameter to center the divisions.
Edited by Jikian - 2023年1月15日 21:34:56

Attachments:
div_bbox.PNG (25.2 KB)
div_bbox2.PNG (42.2 KB)

User Avatar
Member
67 posts
Joined: 4月 2017
Offline
Ok. Thanks.
Thats one part of the problem.
But I need the use of SWITCHER between odds and pairs.
... Or use VEX > Wrangle(primitives) to switch pair/odds from input.

Years ago I saw that code, now I lost it.

In documentation there is only a mention to ot in Arrays
int odd = nums; // { 1, 3, 5 }
User Avatar
Member
8786 posts
Joined: 7月 2007
Offline
bhbilbao
I have a wall , sometimes with odd number of prims (3,5,7..) and other times pairs numbers (2,4,6..).

Depending that number the switcher must select the correct one (0 or 1).
Sounds like you want
nprims('../reverse5')%2

You may need to swap your inputs as even numbers will return 0 and odd ones 1
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
67 posts
Joined: 4月 2017
Offline
yEAH! Thats was the code.
Thanks!
  • Quick Links