Skip to main content
1-Visitor
November 27, 2017
Solved

How to make text with dimensions ?

  • November 27, 2017
  • 1 reply
  • 2244 views

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

Best answer by KenFarley

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.

1 reply

KenFarley
KenFarley21-Topaz IIAnswer
21-Topaz II
November 27, 2017

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.

Gaph1-VisitorAuthor
1-Visitor
November 27, 2017

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