Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
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
Solved! Go to Solution.
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.
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.
Thank you very much Mr Farley. That's perfect.