I don't see any mention of how Fusion treats even/odd values in IF statements, here. Am I looking in the wrong place?
I need a parameter for a feature pattern that offsets the seed to a different location depending on if it has an even or odd number of instances along a particular axis.
I am aware that there are alternative (possibly better!) means to the same end, but this question is about even and odd values in IF statements. I just want to know if there is an intended workflow or workaround to use it in logic in Fusion.
Are there more operators than what is shown in the link above?
Solved! Go to Solution.
Solved by g-andresen. Go to Solution.
Solved by MRWakefield. Go to Solution.
Solved by jhackney1972. Go to Solution.
Take a look at this model where I determine the placement of partitions using a test for even or odd on the partition placement. If the placement is even, the Joint Offset value is applied, if it is odd, it is not. I too could not find an direct statement to determine even or odd so I created a little test then applied the test to an If statement. There are two of these tests in the model, one for each partition direction. Model is attached.
John Hackney, Retired
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
You could use the "Modulo" operator with a value of "2" as the divisor:
If this answers your question please mark the thread as solved as it can help others find solutions in the future.
Marcus Wakefield
I like this. If after the value is divided by two and rounded up, and the rounding figure is larger than the original figure divided by two, then it is odd. That works well for whole integers, which is all I would use for a number of instances in a pattern.
Thumbs up!
My fear was that null values for length isn't allowed in Fusion, but you clearly are using it here. Nice!
@jhackney1972 wrote:Take a look at this model where I determine the placement of partitions using a test for even or odd on the partition placement. If the placement is even, the Joint Offset value is applied, if it is odd, it is not. I too could not find an direct statement to determine even or odd so I created a little test then applied the test to an If statement. There are two of these tests in the model, one for each partition direction. Model is attached.
This was the answer I was looking for. Thanks!
@MRWakefield wrote:You could use the "Modulo" operator with a value of "2" as the divisor:
I'm pleased it worked for you 😀
If this answers your question please mark the thread as solved as it can help others find solutions in the future.
Marcus Wakefield
@g-andresen wrote:Hi,
This also works if modulo is not known.
günther
This is also good. Thanks!
In the meantime, I found this, which is a lot more information than the page I linked to originally.
Can't find what you're looking for? Ask the community or share your knowledge.