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

convert real number into srting with decimals in relation

Nash
1-Newbie

convert real number into srting with decimals in relation

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.
18 REPLIES 18
MartinHanak
23-Emerald V
(To:Nash)

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


Martin Hanák

It worked great

Thanks Martin

DavorGranic
14-Alexandrite
(To:MartinHanak)

Hi Martin,

I`m interested how would you do the same with number like 40.046 keeping it with 3 decimals.

Just wana compare it with what I used for getting part dimensions writen as overall size parameter.

Thx in advance

Davor,

try:

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

Martin


Martin Hanák
Kevin
10-Marble
(To:Nash)

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.

Nash
1-Newbie
(To:Kevin)

Hi Kevin,

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

Kevin
10-Marble
(To:Nash)

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.

Kevin,

I am trying to do just that – create a parametric note for our PTC fastener library parts so that the instance description displays properly in a BOM table.

I am able to create a 3D note in the part generic, called “DESCRIPTION”, with the text something like “WASHER, PLAIN, TYPE A, FOR &BOLT_DIA IN SCREW, OD &B IN”. When I make a drawing of a particular instance, the correct description appears in a note with the parameter “&DESCRIPTION”.

This is where I am not having any luck: When I make an assembly drawing with a BOM table, the report parameter for the repeat region is asm.mbr.description, which properly displays the description of other components (which don’t use parametric notes), but the washer description does not show up.

It seems to me like the 3D note needs to be assigned to an actual parameter – right now there is no parameter in the generic part parameter list called “DESCRIPTION”.

What am I missing here? Please see the attached screenshots.

I am using WF 5.

Thanks,

Andri Ulrich

washer.JPG

param.JPG

part_dwg.JPG

asm_dwg.JPG

You will want to change the note name to something other than DESCRIPTION for this method since you will get an error stating that the name is already in session. What the name is isn't important what you need is the note ID number found in the upper right of the note dialog box in your first picture. Create the DESCRIPTION parameter in the parameter dialog (second picture), change the type to NOTE, and enter the note ID number in your case 1. In the part you won't see the note text in the parameter dialog box but it should show in your BOM table (last picture).

Kevin,

awesome, that's the part I was missing! Thanks for clearing that up.

Andri

Andri,

I recently find this cool way of link dimensions to bom table repeat region parameter and test it. The only silly thing is that it sometime show a minus sign in front of dimension such as item 2 in attached pic, both length & the thickness have minus sign in the dimensions. I like to know if you have any fix. Thanks!

Min

bom+problem.jpg

Kevin,

since you seem to have a good understanding of the standard PTC fastener library, here is another question:

How do you work with the inch fasteners such as bolts and nuts considering there is no thread data in the family tables?

Typically we like to define the thread pitch (UNF or UNC) for our bolts and nuts in the BOM table callout, but since a typical PTC fastener library bolt only has the nominal diameter and length available as a parameter, I would have to manually add thread pitch to the BOM entry. In other words, I'd like to display something like nominal_dia, thread_pitch and length (such as SHCS 1/4-20, 1" Length) in my BOM tables.

I understand I probably need to add thread pitch data in each library part generic, but perhaps there is a clever way to let me choose UNC or UNF thread as one of the famility table parameters, such that when you select UNF and a 1/4" diameter bolt, the callout will automatically display 1/4"-28.

What's the easiest way to do this while minimizing required end user input?

Andri

For the most part we have just specified the parameters and filled them in. Trying things on my own there have been other things I've tried that seem to work well. For the most part if you are setting up a family of fasteners there really shouldn't be any need for user input except for on the dialog that comes when you select the family table generic if I understand what you're asking correctly.

For instance, using your note format of SHCS 1/4-20, 1" Length, you could set this up using the same note method. You would need to add either the text to the note for SHCS, -20, and Length or setup parameters to input what you want shown. For the parameter DESCRIPTION that shows in the BOM it would be setup like before in your washer example to input a note ID number. The note setup might be in the form &COMP_TYPE &NOMINAL_DIA-&TPI &SERIES-&CLASS &LENGTH &DESCRIPTOR. You have the user input the information manually (which is what we've done) or another way, which is what I've played around with a little, is to use restricted definition parameters to limit the input selections. These will only allow the values specified so if a user tries to input something other than what you specified for the input an error is issued. So you could create restricted parameters for all of these and let the user chose from specific values, for instance &COMP_TYPE might have the selections of SHCS, WASHER, or NUT. You could set &NOMINAL_DIA and &LENGTH to specific selections if you have only certain sizes and lengths you use and then add relations in the generic that allow these parameters to control the geometry dimensions. For your case you might want to set &SERIES to only have selectable values of UNC and UNF. For &DESCRIPTOR you might set it for LENGTH, DIA, and THICKNESS. For &TPI you might specify a list of values that can be selected or instead of making it a resticted definition parameter just write relations so when the &NOMINAL_DIA and &SERIES are specified the value for &TPI is set to a value, for instance for 1/4 and UNC &TPI is set to 20 and for 1/4 and UNF &TPI is set to 28. Might be overkill but just depends on what you want to do and how you want to implement it.

huggre
1-Newbie
(To:Kevin)

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?

huggre
1-Newbie
(To:Kevin)

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?

huggre
1-Newbie
(To:Nash)

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?

Kevin
10-Marble
(To:huggre)

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.

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.

Announcements