Skip to main content
Jun 6, 2012 9:18 PM UTC
Delivered

Real to String in Relations

Related products:Creo Parametric

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.

20 replies

Feb 10, 2022 2:46 PM UTC

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!

Mar 14, 2022 6:55 AM UTC

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.

Apr 12, 2022 4:50 PM UTC

Bump. I need RtoS

Dec 6, 2022 10:14 PM UTC

Bump. Simple RtoS function would be very helpful.

1-Visitor
Dec 16, 2022 7:44 AM UTC

PTC, here's the Toolkit code - feel free to use it:

 

// Customized relation function "rtos"

ProError convertDoubleToString(ProRelset *pro_relset, ProMdl pro_model, char *extfunc_name, ProParamvalue *pro_args, ProAppData app_data, ProParamvalue *pro_result)
{
	pro_result->type = PRO_PARAM_STRING;
	if (pro_args[1].type == PRO_PARAM_INTEGER)
		ProTKSwprintf(pro_result->value.s_val, L"%.*f", pro_args[1].value.i_val, myRound(pro_args[0].value.d_val, pro_args[1].value.i_val));
	else
		ProTKSwprintf(pro_result->value.s_val, L"%f", pro_args[0].value.d_val);

	return PRO_TK_NO_ERROR;
}

ProError convertDoubleToStringArgscheck(ProRelset *pro_relset, ProMdl pro_model, char *extfunc_name, ProParamvalue *pro_args, ProAppData app_data)
{
	if (pro_args[1].type == PRO_PARAM_INTEGER && (pro_args[1].value.i_val < 0 || pro_args[1].value.i_val > 6))
		return PRO_TK_GENERAL_ERROR;

	return PRO_TK_NO_ERROR;
}

ProArrayAlloc(2, sizeof(ProRelfuncArg), 1, &args_array);
args_array[0].type = PRO_PARAM_DOUBLE;
args_array[0].attributes = PRO_RELF_ATTR_NONE;
args_array[1].type = PRO_PARAM_INTEGER;
args_array[1].attributes = PRO_RELF_ATTR_OPTIONAL;
ProRelationFunctionRegister("rtos", args_array, convertDoubleToString, NULL, convertDoubleToStringArgscheck, PRO_B_FALSE, NULL);
ProArrayFree(&args_array);

 

Jan 2, 2023 3:36 PM UTC

Hello PTC,

maybe you can implement this now, in 2023?
There is no need for 3D printing or Industry 10 dot ohhh, sometimes you have to work under the hood and dont polish the new version to make it even more shiny.

Work on the engine itself - please.

Apr 21, 2023 1:29 PM UTC
Status changed to: Under Consideration

This is under consideration for Creo 11

Feb 16, 2024 10:12 AM UTC
Status changed to: Implementation In Progress
Apr 17, 2024 8:56 PM UTC
Apr 18, 2024 7:22 AM UTC
Status changed to: Delivered