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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

possible rtos workaround

ptc-2896700
1-Newbie

possible rtos workaround

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.
3 REPLIES 3

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

I HOPE PTC DEVELOP A FUNCTION TO DO SOMETHING LIKE THIS

THANX CSNYDER

GCF

SikiF
5-Regular Member
(To:GustavoCárdenas)

Beware it does not work!

If you have number eg 150.05 you get 150.5 !

Top Tags