Skip to main content
1-Visitor
March 28, 2011
Question

convert real number into srting with decimals in relation

  • March 28, 2011
  • 4 replies
  • 14158 views

Hi all,

I am a pro-e user form a long. I have a problem with the concatenate function in relation.

I want to join a string & the dimension for the description of my model.

Ex. If the part name is Drain-line-01 & length of the part is 202.5mm.

Then the decription of the part is to be "Drain-line-01 202.5mm.

I created a parameter

Description "string"

L "real number" for the length of the part

I used a relation to achive it description = rel_model_name + " " + L + " " + "mm"

Then the decription of the part is to be "Drain-line-01 202.5mm.

but i get an error.

error Invalid data type combination at right side of expression

I need this description with the decimals in the description

Please anybody help

Thanks in advance


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.

4 replies

24-Ruby III
March 28, 2011

Naresh,

try:

desc=rel_model_name+" "+extract(itos(L*10),1,string_length(itos(L*10))-1)+","+extract(itos(L*10),string_length(itos(L*10)),1)+" mm"

Martin

Nash1-VisitorAuthor
1-Visitor
April 1, 2011

It worked great

Thanks Martin

1-Visitor
March 28, 2011

Another thing I've done in the past is to create these types of descriptions as notes. You use the parameter names required and there is no need for a relation. In a repeat region it doesn't matter if the description is a different type from one model to another.

Nash1-VisitorAuthor
1-Visitor
April 1, 2011

Hi Kevin,

I didnt get you, how can a notes be linked to a parameter can you please give an example

1-Visitor
April 1, 2011

As example you could use a fastener description. It might have the thread type as well as the length of the fastener. Since you want to combine both text and real numbers you need to write a relation that converts the real numbers into a string. Another method is to create a model note. With a note you combine the part parameter names with the desired text. So you note might have the form: &d1-28 UNC X &d2 LONG. With this there's no need for a relation to convert the real numbers into text. For your parameter DESCRIPTION, if it's not already created you can change the type to Note when creating the parameter. If DESCRIPTION is already created as a String type you can change it by creating a temporary parameter of Note type and write a relation that sets DESCRIPTION equal to the temprory parameter and then delete the temporary parameter afterward. You won't see the note text when looking at the parameter list in part mode you specify the Note ID number which is found on the note properties dialog box. When you use DESCRIPTION in a note or repeat region it displays the text and will update with changes to the model. For your example the note might be: &model_name &d1 mm.

1-Visitor
November 8, 2011

Kevin

I think that using note parameters instead of strings is a great idea to avoid having all the "real to string" conversions.

However, as far as i can see, you can not designate a note parameter if you want to capture the value in Windchill.

Do you have any idea if it is possible to convert the value of a note parameter back to a string using relations?

1-Visitor
November 15, 2011

I think you're going to have to use Martin's method. You might be able to use a simpler format for the conversion of a real number to a string.

13-Aquamarine
November 16, 2011

One other point of interest about using NOTE parameters to drive bill of material data. You can modify model dimensions directly from the note.

Let's say you had modeled an object from a piece of common stock (such as a structural angle) You might normally provide the height, width, and length information for such an object in your BOM description. For a simple piece of 2" angle, your DESCRIPTION might be similar to the following:

Angle, 2" x 2" x 1/4" x 25.00 Long

If you create this as a NOTE parameter instead of a string parameter (as Kevin suggested), you can have some of this data fill in automatically. Certainly when you modify model dimensions, the note will update... but if you double-click directly on the values in the note, you can modify the model dimensions, too.

In the example above, if you double-clicked on the "25.00", you'd be prompted to enter a new value. Upon regeneration, the model and note would both update to the new value.