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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Add rtos() function to Pro/Program

Add rtos() function to Pro/Program

There have been small incremental updates to Pro/Program with the addition useful functions.

There is one that is very much needed, rtos(). Similar to itos().

 

itos(int) converts an integer to a string.

rtos(real, decimals, comma) would convert a "real" number to a string, formating it with the specified number of "decimals" places, and a boolean parameter "comma" to indicate if we want to use a "dot" or a "comma" separating the integer part from the decimals part.

 

To be able to do this and have part reference strings aumatically generated using pro/program associated with real parameters that the user specifies, is a very tedious process.

 

Examples:

 

itos(45) would produce "45" as a string

rtos(45.778, 2, true) would produce "45,78"

rtos(45.778, 2, false) would produce "45.78"

rtos(45.778, 1) would produce "45.8"

rtos(0.0, 2) would produce "0.00"

 

The workarounds that have to be made to make this simple processing is tedious and implies having to generate additional temporary parameters that clutter the main parameter user interface.

 

Or better yet, instead of adding only the "real to string" function, maybe it would be better to include a generic formating function with the possibility to specify left or right sided formating, specifiying minimum length of the output string, to be padded with spaces or zeros.

1 Comment
MikkoHinkkanen
13-Aquamarine

See also related Product Idea.