×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

integer function in relations?

integer function in relations?

integer function in relations?

(OP)
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

RE: integer function in relations?

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

RE: integer function in relations?

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

RE: integer function in relations?

(OP)
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?  

RE: integer function in relations?

How about using the ITOS() function? This will make your real number into a string.

So if d1=2.75, then floor(d1)=2, and itos(floor(d1))=2 but as a string value.

Can this help you out?

Steve

http://www.3dlogix.com

RE: integer function in relations?

(OP)
I had tried the itos function, but the toolkit did not accept the string value.  Thanks though!Ron.

RE: integer function in relations?

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.

RE: integer function in relations?

(OP)
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

RE: integer function in relations?

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources