Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mod-function in the relations

Status
Not open for further replies.

CADien

Industrial
Mar 4, 2008
2
In Pro E Wildfire 3.0 is it possible to click - inside the relations - on an icon with fx on.
Then you got a submenu with all the function who are possible in wildfire. If you look closely, you can find a 'mod' function. I thought it was the remainder of a division of one number by another.
I need that function in my automation-program.
What I wanted to do was the following thing:
If (mod(LENGTH/X, 2) == 0
Y = ..
ELSE
Y =...
ENDIF


So in fact, I need to check if the number is odd or even.

Now the problem is, I know the 'mod'-function exist, because i can find it in the list, but i don't know how to implement it.
I guessed it was MOD(NUMBER1,NUMBER2) but cleary this doesn't work, because always, even if the number is even or odd, it skips the if-statement, just like i wrote something that can't be true


Someone who knows this? Because I check your FAQ and those functions are clearly not allowed
 
Replies continue below

Recommended for you

Well, I can't find it in the help anywhere but a little experimentation gave the following:
mod(5,2)=1
mod(5,3)=2
mod(5,4)=1
mod(2,2)=0
mod(7,4)=3
So I would say MOD returns the remainder after a division just like you expected. I think you are missing a closing ")" in your equation.
 
After searching and searching (i've been searching this stupid function for like a half a day now), it looks like you're right. And I've found my 'mistake'.

I've implemented a function:
Z = X/Y with X = n*Y and Y = reel number (ex: 150.8) with n an integer!
and then used Z in MOD(Z,2)
And he always returned 2 as remainder. The problem was that I didn't 'round' (floor i supposed, I never checked ceil) Z,
If i implement Z = floor(X/Y), the mod-function did work after all. Apparently the following works without floor:
Z = X/Y with X = n*Y en Y = 7.0
although i implemented X en Y as a reelnumber and not an integer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor