cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Converting real numbers to string

Converting real numbers to string

How I can convert real numbers to strings. If I use the function “itos(int)� the real number will be rounded off and I want to keep the decimal places to appear in the string. My idea is to have one string parameter created from few real numbers parameters. For example: Size = length x width Where: Size is a string parameter. Length & width are real numbers parameters extracted from actual dimensions in my part. The only way I found so far to achieve this is to multiply the real number by 1000 (if I want to keep 3 decimal places ), then using “itos(int)� & “extract(string, position, length)� to configure the desired string, digit by digit. But that is very complicated for something, which seems so simple. Any better ideas? Thank you
2 REPLIES 2
Highlighted

RE: Converting real numbers to string

Vasko Currently i dont think there is a nother way. I have requested a real to string function for future Pro/E versions but have not heard anything from PTC about this request. Hugo

A Relation based solution....

Vasko Probably the answer could be this. c="." if (acc<1) c="" endif a=itos(x*10^acc) l=string_length(a) b=extract(a,1,(l-acc))+c+extract(a,(l+1-acc),acc) where: acc = is a parameter which sets the number of decimal values required x = the real number which has to be converted to string b = the converted string to the required number of decimal places of "x". If you can put this code into your relations for each real number to be converted to string, you will get your answer. After all once the code works, one does not need to bother about it again Best regards M.P.Saju
Announcements