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

Real to String in Relations

Real to String in Relations

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;

T=6.35 100x500

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

TK=ITOS(MODEL_THICKNESS*100)

DIMENSION="T= "+ EXTRACT(TK,1,1) + "." + EXTRACT(TK,2,2) + " X " + ITOS(MODEL_WIDTH) + " X " + ITOS(MODEL_LENGTH)

ENDIF

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)

ENDIF

Luckily we display our dimensions in mm, so I only have to support the imperial thickness of the materials.

13 Comments
DavorGranic
14-Alexandrite

Same problem here. Too many lines of relations to get the same result.

James62
9-Granite

Rtos function would be a huge timesaver for starters.

DomenicLaritz
16-Pearl

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?!

RaymonDavies
6-Contributor

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.

jkent
3-Visitor

We ended up using JLink to create our real to string function.

fgermain
7-Bedrock

We are in the same case

We use relation:

     rtos_param=itos(floor(param))+"."+extract(itos((1+(param-floor(param)))*10000),2,3)

if param=2.05 rtos_param returns 2.050

for 4 digits after comma, use

     rtos_param=itos(floor(param))+"."+extract(itos((1+(param-floor(param)))*10000),2,4)

if param=2.05 rtos_param returns 2.0500

...

TomU
23-Emerald III

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

psobejko
12-Amethyst

Wow.  Still shaking my head about this one.

Keep voting Does PTC ever read these?

PTCModerator
Emeritus
Status changed to: Acknowledged
 
Jaime_Lee
Community Manager

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;

 

T=6.35 100x500

 

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

TK=ITOS(MODEL_THICKNESS*100)

DIMENSION="T= "+ EXTRACT(TK,1,1) + "." + EXTRACT(TK,2,2) + " X " + ITOS(MODEL_WIDTH) + " X " + ITOS(MODEL_LENGTH)

ENDIF

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)

ENDIF

 

Luckily we display our dimensions in mm, so I only have to support the imperial thickness of the materials.

TomU
23-Emerald III

This product idea is nearly 10 years old and still hasn't received a single response from anyone in Creo product management.

 

To put this in perspective, this idea was created when Creo Parametric 1.0 M040 was current.  Since then we've seen Creo 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, and 8.0 (89 separate builds) come and go.  Other ideas have been implemented with only a single vote, yet this one with 192 votes (10th most voted idea) has not.

 

It would be great if someone from Creo product management, responsible for this area of the product, could reply to this idea with an explanation.  Why hasn't this idea been implemented at some point in the past 10 years?  Are there any plans to implement it in the near future?  Any feedback at all would be greatly appreciated!

PetrP
14-Alexandrite

Typical PTC. Instead of implementing "RtoS" command they give us complicated workaround and after 10 years expecting to archive this topic as "solved". I really don't know why they run this ideas comedy when not willing to implement it. Every "acknowledged" idea with 100+ votes should be implemented to next Creo version asap.

VMcD
12-Amethyst

Bump. I need RtoS