Search - User list
Full Version: filter expression
Root » Houdini Lounge » filter expression
Bernard
Hello,


I'm using a group node with filter expression.
Does anyone know an expression to select only the ‘even’ primitive numbers of my input grid ?


thanks,



bern
graham
Try

$PR % 2 == 0
whalerider
Yep, what Graham suggested is what you need.
Basically, you need to know what variable carries information about primitive number. It's $PR - see Local Variables under hdox/houdini/content/helpcards/sop/primitive.html

Then you need to find whether the primitive number is divisible by 2 or not.
For that you need the modulus function (%) - which gives you the remainder
of dividing one number by another number. If the remainder of division by 2 is 0, you know you're dealing with an even number.

Hence, the expression is $PR%2==0 (== checks whether a condition is true, = is the assignment operator, so make sure to use =
Dean_19
modulus is so useful…really good expression to know..
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB