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

Participant

## Enter Dimension Values into Part Description

I am trying to enter a dimension value, such as d1 into a parameter such as "Part_Decription."

I have tried using a relation statement like: Part_Description = "PIPE" + istr(@d1). All that this gives me is: PIPE istr(@d1)

What I am trying to do is extract the ID and OD from a tube and place it into my part description. I would also like to do the same thing for the length of the pipe.

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.
Tags (1)
12 REPLIES 12

## Re: Enter Dimension Values into Part Description

itos() is the function you want.

## Re: Enter Dimension Values into Part Description

What does the relation look like? I am guessing it will look something like: Part_Description = "Pipe" + itos(@d1)   Is that correct?

## Re: Enter Dimension Values into Part Description

I expect you don't need the "@" sign either. Creo already knows that d1 is a parameter.

## Re: Enter Dimension Values into Part Description

Thank you for your assistance. This is helping A BUNCH. There is one more thing. How do you control the number of decimal places in the value that comes up for "d1" in this case? Is it something like: d1[.3"?

## Re: Enter Dimension Values into Part Description

There should not be any decimal places. Integer to String. If you want to keep them you need to add more complexity - such as multiplying by the power 10 = desired decimal places and then extracting the parts and shoving a decimal point character into place. Use the extract function. Searching the Community should turn up examples.

These are some functions that can help:

Supposing param = "abcdef", then:

flag = param == "abcdef"               —returns TRUE
flag = abcdef != "ghi"                       —returns TRUE
new = param + "ghi"                       —new is abcdefghi
new = itos(10 + 7)                           —new is 17
new = param + itos(1.5)                —new is abcdef2
where = search(param, "bcd")      —where is 2
new = extract(param,2,3)               —new is bcd

## Re: Enter Dimension Values into Part Description

I wonder if there is another parameter extraction tool that will produce something like "4.50" for the dimension that equals "4.50"?

## Re: Enter Dimension Values into Part Description

Double 2 String Relation

This is another good solution

Converting Real Numbers to Strings

## Re: Enter Dimension Values into Part Description

I found all of this programming stuff to be rather daunting. I did, however, get the Y value to show up correctly in my relations. Now I cannot figure out what kind of syntax will place that "Y" value into my "Part_Description" parameter.

## Re: Enter Dimension Values into Part Description

Part_Description = "PIPE" + Y

## Re: Enter Dimension Values into Part Description

I use this in relations for a 3 place decimal used in a string:

if LENGTH - floor(LENGTH) ==0

DEC_LEN ="000"

else

DEC_LEN = extract(itos((LENGTH-floor)LENGTH+1)*1000,2,3)

endif

PARM_TITLE = itos(floor(LENGTH)+'.'+DEC_LEN

CAPITAL params can be any names you want.

If you only want 2 decimal places, then use this line:

DEC_LEN = extract(itos((LENGTH-floor)LENGTH+1)*100,2,2)

## Re: Enter Dimension Values into Part Description

Depending upon your needs, you can create a note in the model and set the parameter to report it. Once you create a note, a new option will appear from the "Type" drop down list as in the following images.

The reason why I said, "Depending upon your needs...", is because this is quirky and PTC doesn't want to make it as awesome as it can be. You can craft the note like you would on the drawing, but it will only show the note number in the parameters. I find myself opening a family table instance, or an assembly BoM containing the component, to see what the value actually looks like in the end. I can tolerate that, but here's the worst of it: if you make a family table of your component, and then show a family table driven repeat region parts list on the drawing, all the values will report what the generic is set to.

It sucks, I know. That is why I typically only use this method for reusable hardware, like internal nuts, bolts, etc, that sort of don't have their own drawings (I don't want to try and explain this internal mess when there are clearly better ways). In doing so, they are always only used in assemblies and in an assembly driven repeat region BoM, this function works as you would expect. I think there is something going on with a secondary validation that enables the BoM table to show correctly.

Problem Reference:

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS177911

## Re: Enter Dimension Values into Part Description

I want to thank you for all of your assistance. It took me a day to learn how to do what I wanted to do, but it was worth it.

Announcements