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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

How to make text with dimensions ?

Gaph
3-Visitor

How to make text with dimensions ?

Hi,

I made a family table with Creo 2. I would like to extrude a text so that each instance will have the indication of its own dimensions (example : 10.2x8.6x3.0).  Each dimension must be truncated with only 1 decimal.

(My dimensions are D5, D6 and D7)

I don't know how to truncate dimensions, how to create the complete text.

Can you help me ? Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
KenFarley
21-Topaz I
(To:Gaph)

To build a text string that can be displayed or extruded, etc. you need to define a "String" parameter. Use Tools->Parameters and "String" is one of the drop-down entries for the "Type". Let's assume its name is "txtmrk".

Now you build the string using the values, using Tools->Relations.

 

--- [ Begin Relations ] ---

 

numdigits = 1
txtmrk    = ""
IF D5 < 1.0
  txtmrk = txtmrk + "0."
ELSE
  txtmrk = txtmrk + ITOS ( floor ( D5 ) ) + "."
ENDIF
txtmrk = txtmrk + EXTRACT ( ITOS ( floor ( 10^numdigits * ( 1 + D5 - floor ( D5 ) ) ) ), 2, 1 )
txtmrk = txtmrk + "x"

IF D6 < 1.0
  txtmrk = txtmrk + "0."
ELSE
  txtmrk = txtmrk + ITOS ( floor ( D6 ) ) + "."
ENDIF
txtmrk = txtmrk + EXTRACT ( ITOS ( floor ( 10^numdigits * ( 1 + D6 - floor ( D6 ) ) ) ), 2, 1 )
txtmrk = txtmrk + "x"

IF D7 < 1.0
  txtmrk = txtmrk + "0."
ELSE
  txtmrk = txtmrk + ITOS ( floor ( D7 ) ) + "."
ENDIF
txtmrk = txtmrk + EXTRACT ( ITOS ( floor ( 10^numdigits * ( 1 + D7 - floor ( D7 ) ) ) ), 2, 1 )

 

--- [ End Relations ] ---

 

Now that you've got the parameter that contains the text you need. Whenever you define a text entity in a sketch, you can tell it to "Use Parameter" and pick the "txtmrk" you defined in the relations.

View solution in original post

2 REPLIES 2
KenFarley
21-Topaz I
(To:Gaph)

To build a text string that can be displayed or extruded, etc. you need to define a "String" parameter. Use Tools->Parameters and "String" is one of the drop-down entries for the "Type". Let's assume its name is "txtmrk".

Now you build the string using the values, using Tools->Relations.

 

--- [ Begin Relations ] ---

 

numdigits = 1
txtmrk    = ""
IF D5 < 1.0
  txtmrk = txtmrk + "0."
ELSE
  txtmrk = txtmrk + ITOS ( floor ( D5 ) ) + "."
ENDIF
txtmrk = txtmrk + EXTRACT ( ITOS ( floor ( 10^numdigits * ( 1 + D5 - floor ( D5 ) ) ) ), 2, 1 )
txtmrk = txtmrk + "x"

IF D6 < 1.0
  txtmrk = txtmrk + "0."
ELSE
  txtmrk = txtmrk + ITOS ( floor ( D6 ) ) + "."
ENDIF
txtmrk = txtmrk + EXTRACT ( ITOS ( floor ( 10^numdigits * ( 1 + D6 - floor ( D6 ) ) ) ), 2, 1 )
txtmrk = txtmrk + "x"

IF D7 < 1.0
  txtmrk = txtmrk + "0."
ELSE
  txtmrk = txtmrk + ITOS ( floor ( D7 ) ) + "."
ENDIF
txtmrk = txtmrk + EXTRACT ( ITOS ( floor ( 10^numdigits * ( 1 + D7 - floor ( D7 ) ) ) ), 2, 1 )

 

--- [ End Relations ] ---

 

Now that you've got the parameter that contains the text you need. Whenever you define a text entity in a sketch, you can tell it to "Use Parameter" and pick the "txtmrk" you defined in the relations.

Gaph
3-Visitor
(To:KenFarley)

Thank you very much Mr Farley. That's perfect.

Top Tags