Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

integer function in relations?

Status
Not open for further replies.

badd63

Mechanical
Jun 27, 2002
9
0
0
US
Does anyone know if there is an integer function in relations to change a real value to an integer?

I am using a pro/Toolkit program that requires an integer value from a certain dimension on every part. Currently, we must show the dimension, round it, then type in the value. I would much rather automate it! The ceil() function does not change the paramer type.

Thanks, Ron
 
Replies continue below

Recommended for you

Hi,

floor() and ceil() are your functions you need.

floor(.750) = 0
ceil(.750) = 1

Create a new integer parameter "dummy" and assign it the value calculated with ceil() or floor() function from your dimension:

dummy = floor(d3)

Now "dummy" is an integer and will hold a integer value. Use the variable "dummy" as input for your Pro/Toolkit program.

Good luck!

:) -Hora
 
If you need to round the value up or down instead of always up or always down, I would suggest you add .5 to the value before you use the floor function. That should work the same way as the ROUND function in Excel.

From Hora's example:

floor( .750 ) = 0.000
floor( .750 + .500 ) = 1.000

BML
 
I tried the floor() and ceil() functions. They round to the correct value, but the value is still a real number. From Hora's example,
floor( .750 ) = 0.000
but, i would want the answer to be 0

also, if you look at the parameter list, "dummy" is listed as a real number. Then if i deleate the parameter and manualy put it in as an integer, the pro/toolkit program works fine. What I need is some function like (as in fortran):
int(floor( .750 )) = 0

any suggestions?
 
Hi Ron,

You are right about the changing type of the variables. When you create an integer parameter in Pro/E this parameter will allow you to introduce only integer values and not something like "floor(.750)". Strange because the result of the "floor(.750)"is an integer value (this is what Pro/E book is saying). Pro/E will allow to introduce only values like 0, 1, 2, etc. The "parameter info" command will show that "dummy" is an integer having value 0. (example)

Let's add in relations the following sentence:

dummy = floor(.750)

Note that the integer variable dummy can keep the result of expresion floor(.750). There is no error message.

But if you have the curiosity to see what happend with the variable dummy, you'll have the surprise to see that the integer "dummy" has been transformed into a float variable and the value assigned is not 0 but 0.00000e+05.

I think there are no solutions to your problem except these:

A. manualy introduce the value asked by Pro/Toolkit application;

B. to change the variable type fron integer to fload in the C/C++ code of your Pro/Toolkit application and re-complile it.

-Hora.
 
Thanks Hora, that is what I was afraid of... Can you recommend a good book for learning to use pro/toolkit? I don't know c/c++ but do know fortran/vis basic/matlab/unix scripting/ and a few others so it shouldn't be too bad.

<b>thanks!</b>
Ron
 
Hello again Ron,

I'm affraid I cannot recommend you a book for learning Pro/Toolkit because they are not.

But if you know FORTRAN and VB, then you can try yourself to modify the program. You may encounter some problems at compiling stage, but there are solutions to that. Or, if you want, you can send it to me and I will try to make the modification for you. If you agree, I will give you my e-mail address.

-Hora.
 
Status
Not open for further replies.
Back
Top