I would like to have a Real to String function in relations. Our company standard defines the display of the dimensions of a part as a string parameter in our BOM;
In order to get this currently I have to write a very complex relation to extract the values from the models;
IF MODEL_THICKNESS < 10
DIMENSION="T= "+ EXTRACT(TK,1,1) + "." + EXTRACT(TK,2,2) + " X " + ITOS(MODEL_WIDTH) + " X " + ITOS(MODEL_LENGTH)
IF MODEL_THICKNESS >= 10
TK = ITOS(MODEL_THICKNESS*100)
DIMENSION="T= "+ EXTRACT(TK,1,2) + "." + EXTRACT(TK,3,2) + " X " + ITOS(MODEL_WIDTH) + " X " + ITOS(MODEL_LENGTH)
Luckily we display our dimensions in mm, so I only have to support the imperial thickness of the materials.
Same problem here. Too many lines of relations to get the same result.
Rtos function would be a huge timesaver for starters.
We developed a "real to string" function for relations with Pro/TOOLKIT.
Only some 10 or 20 lines of code were necessary to realize this.
@ PTC: It's so easy, why we're still waiting for that?!
Not sure why we're waiting, as you said this should be a very simple request. I opened a request for this back in.... I would say 2004. It seems things have changed from their side, I don't see it in the SPR anymore.
We ended up using JLink to create our real to string function.
We are in the same case
We use relation:
if param=2.05 rtos_param returns 2.050
for 4 digits after comma, use
if param=2.05 rtos_param returns 2.0500
Here is my three decimal place version. This includes automatic rounding. X is the real number and Y is the string.
/* String Output - No Leading Zero, Three Decimal Places
Y = ITOS(FLOOR(X+.0005))+"."+EXTRACT(ITOS(((FLOOR((X+.0005),3))-FLOOR(FLOOR((X+.0005),3))+1)*1000),2,3)
Other versions are available here: Converting Real Numbers to Strings
Wow. Still shaking my head about this one.
Keep voting Does PTC ever read these?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.