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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Parameters and relations

ssuttle
7-Bedrock

Parameters and relations

All,

I am trying to write a relation that uses a model parameter and a dimension to create a new parameter.

Parameter: Description Value: Socket Head Cap Screw

Parameter: Size Value: 2-56

Dimension: Value .125

Put these all together to come up with:

Socket Head Cap Screw 2-56 X 125
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.
3 REPLIES 3
dgschaefer
21-Topaz II
(To:ssuttle)

I'm not totally familiar with this stuff because I do it so
infrequently, so someone correct me if I go astray. 😄



I know with the string parameters, a relation like this will generate a
new string parameter "SCREW" with a space in between:



SCREW = DESCRIPTION + " " + SIZE



I don't think you can simply add the dimension number to that, however.
You may be able to use the ITOS (integer to string) command to make a
string parameter from it like this (assume a dimension name of d123).
First, however, you'd have to change your 3 place decimal to a string:



STRING_d123 = d123 * 1000



Then you'd convert that to a string:



SCREW_LENGTH = ITOS(STRING_d123)



I'm not sure that the syntax is right on that or if it would work if
STRING_d123 wasn't actually an integer.  Does it truncate the number or
does it simply fail?  You may need this to insure it's an integer:



INT_d123 = FLOOR(STRING_d123)



And then convert INT_d123 to a string instead.



Assuming you can get SCREW_LENGTH into a string, I think you could then
do this:



SCREW = DESCRIPTION + " " + SIZE + " " + SCREW_LENGTH



Doug Schaefer
--
Doug Schaefer | Experienced Mechanical Design Engineer
LinkedIn

This is how I have had our relations for fasteners set up for years and it
has worked well for us.

L3 = floor(100 * L) - (floor(L)*100) /* L is the dimension symbol so it is
a "real value". This is set for 2 decimal places change the 100 to 1000 if
your want 3 decimal places and so on for more.
if L3 == 0 /* L3 is an integer parameter for checking if the 2 decimal
places are zero or something else.
L4 = "00" /* L4 is a string value for the decimal places. If you change
the 100 to something else in the top line make sure you match the number
of zeroes here.
else
L4 = itos(L3)
endif
L2 = itos(floor(L)) + "." + L4 + " " /* L2 is the real value of L
expressed as a string.
SIZE = BASIC_DIAMETER + " x " + L2
NAME2 = NAME1 + " " + S_TYPE + " " + S_HEAD + " " + DRIVE + SIZE
NAME = NAME2 + MATERIAL + FINISH

Brian S. Lynn
Technical Coordinator, Product Engineering
ssuttle
7-Bedrock
(To:ssuttle)

Here are the responses I got on this: Number four is the one that
worked in my case. Thanks all for the help.


1) Depending on whether you want the decimal point of the dimension:
Note = Description + " " + Size + " X " + ITOS(Dimension*1000)
or
Note = Description + " " + Size + " X ." + ITOS(Dimension*1000)


2) I do this currently with my part description and part numbers.
Yours would look like this:

TITLE = DESCRIPTION + “ “ + SIZE + “ X “ + DIMENSION.

Add the quotes to add an extra space between the parameters. Also, you
will need to ensure that your Dimension parameter is a string, not a
real number. There is also a relation you can write that converts an
integer to string – the relation is ITOS(parameter). I don’t know if
there is one for non-integer numbers.


3) I’m not sure if I fully understand – but it sounds like you might
ultimately be needed to show that complete string within a dimension or
a note??

Don’t know if this will be an option for you but you can also use this
method If that is the case.

Just change the properties of the Dimension… /(the length in this case)/
to display in the model as a fraction.

Then just simple show the parameters in the sequence that you want with
the last one being the dimension.

Let’s say it’s dimension 10 (d10) for example..

&DESCRIPTION &SIZE &d10

The d10 will display the fractional size that you set in the model.

4) This is how I have had our relations for fasteners set up for years
and it has worked well for us.

L3 = floor(100 * L) - (floor(L)*100) /* L is the dimension symbol so it
is a "real value". This is set for 2 decimal places change the 100 to
1000 if your want 3 decimal places and so on for more.
if L3 == 0 /* L3 is an integer parameter for checking if the 2 decimal
places are zero or something else.
L4 = "00" /* L4 is a string value for the decimal places. If you change
the 100 to something else in the top line make sure you match the number
of zeroes here.
else
L4 = itos(L3)
endif
L2 = itos(floor(L)) + "." + L4 + " " /* L2 is the real value of L
expressed as a string.
SIZE = BASIC_DIAMETER + " x " + L2
NAME2 = NAME1 + " " + S_TYPE + " " + S_HEAD + " " + DRIVE + SIZE
NAME = NAME2 + MATERIAL + FINISH


Top Tags