Skip to main content
1-Visitor
March 26, 2010
Question

possible rtos workaround

  • March 26, 2010
  • 1 reply
  • 2995 views
Hi all, I saw a thread on this in a rants forum when I did a google search for a problem I'm having with the itos function. I need to automatically capture a model dimension in a nomenclature parameter so that it's displayed in a BOM (a standard rail cut to different lenghts). We'd been entering the cut length manually, but that's error prone. The itos function rounds the value, so I figured there must be a similar function which allows decimal places - rtos? Apparently not. Someone on the rant thread developed a lengthy program to grab each digit and output it with a decimal point in the right place, but that's incredibly complex. My buddy here came up with an elegant little piece of code that gets the results I need. pa=d1 (captured dimension) pp=(string text) a=floor(100*(pa-floor(pa))) nomenclature=pp+itos(floor(pa))+'.'+itos(a) a is the returned value, the # of 0's in '100' sets the decimal places of that value (2 in this case), pp is the variable for string text to be output to the same parameter, and pa is the cut length dimension. Hope this helps.

1 reply

10-Marble
August 18, 2011

IT WORKS !!!!!!!!!
I USED THIS CODE, IT WORKS PROPERLY

I HOPE PTC DEVELOP A FUNCTION TO DO SOMETHING LIKE THIS

THANX CSNYDER

GCF

10-Marble
June 19, 2018

Beware it does not work!

If you have number eg 150.05 you get 150.5 !

HamsterNL
18-Opal
June 20, 2018