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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

PARAMETRIC UDF

sparulekar
14-Alexandrite

PARAMETRIC UDF

I am trying to create a parametric udf consisting of a tool no. and that tool no. has to be in an oval shaped box as shown.

The problem is that, if i change the tool number value, the oval shaped box gets cancelled. 

Is there some way in which I can automatically change the the box dimensions whenever the parametric udf text increases.

In short is there any way in which i can make the box length dependent on the udf text length?

I tried using relations but could not get it.

1 ACCEPTED SOLUTION

Accepted Solutions

This seems pretty straightforward, but your explanation as to what you tried and what is not working is just missing.  Did you try to use the STRING_LENGTH() function in your relation, for example:  

 

BOX_SIZE_X = STRING_LENGTH(TOOL_ID_STRING_PARAMETER)*CHAR_WIDTH + PADDING_IN_X

Where BOX_SIZE_X is the name of the dimension for the width of the oval box around your text.  The text content is derived from the string assigned to parameter TOOL_ID_STRING, and the size of the text character and the spacing at the end are specified through real-number parameters CHAR_WIDTH and PADDING_IN_X.

The box and text are "centered" on the same point.

 

Of course, this won't work super well if you need to use a font with variable character widths.  It would be nice if Creo let you get the dimensions of that dashed "bounding" box that it draws around the text object.

View solution in original post

6 REPLIES 6
jbob
11-Garnet
(To:sparulekar)

I first created a string parameter for the tool number.

start your sketch with two construction lines, one vertical that will control text height and the second horizontal from the mid point of the first vertical line out longer than you think the text will go for now. place a point on both ends of the horizontal construction line. select the text command, start your line at the bottom of the vertical construction line and stop at the top of the vertical construction line, select the use parameter button and select your parameter for the tool number. once the text is placed, select the text, you should see a width selection, select it and a dimension will show. find your sd numbers for the horizontal construction line and make that equal to the sd number for the text width, add this to a relation within the sketch. when you create your oval shape be sure you reference the points you added to the ends of the horizontal construction line. change the parameter and the oval shape will follow the text.

jbob
11-Garnet
(To:jbob)

This is not working as expected. once the text length sketcher dimension is used in a relation this locks the aspect ratio of the text. With the aspect ratio locked the text will not change when new characters are added or removed. The aspect ratio will not unlock even after the relation is either commented out or deleted.

jbob
11-Garnet
(To:jbob)

the aspect ratio gets locked when you select the width button for the text, not when you place it in a relation.

This seems pretty straightforward, but your explanation as to what you tried and what is not working is just missing.  Did you try to use the STRING_LENGTH() function in your relation, for example:  

 

BOX_SIZE_X = STRING_LENGTH(TOOL_ID_STRING_PARAMETER)*CHAR_WIDTH + PADDING_IN_X

Where BOX_SIZE_X is the name of the dimension for the width of the oval box around your text.  The text content is derived from the string assigned to parameter TOOL_ID_STRING, and the size of the text character and the spacing at the end are specified through real-number parameters CHAR_WIDTH and PADDING_IN_X.

The box and text are "centered" on the same point.

 

Of course, this won't work super well if you need to use a font with variable character widths.  It would be nice if Creo let you get the dimensions of that dashed "bounding" box that it draws around the text object.

Hi,

I am sending part created in CR2 M070 for your investigation.


Martin Hanák
sparulekar
14-Alexandrite
(To:MartinHanak)

Thanks a lot!!

Top Tags