Skip to main content
Solved

Assigning separate colours to grouped multiline text in AutoCAD


kdwss
Contributor
Forum|alt.badge.img+3
  • Contributor

I can group separate features together for labelling purposes and this is what the attribute looks like as an autocad_mtext_string

 imageHowever, I can only assign one colour by using this approach.

How can I assign separate colours to lines of text within a grouped mtext string so it looks like this?

image.png 

Best answer by caracadrian

Autocad sets color in mtext via \Ccolor_number in strings and font via \fFONT_NAME.

Using this in LabelPointReplacer:

\C3;How now green cow
\C7;How now black cow
\C5;How now blue cow

gives this result:

dwg multi_color_mtextThis string in LabelPointReplacer:

\fISOCPEUR|b0|i0;\C3;How now green cow
\C7;How now black cow
\C5;How now blue cow

gives this result:

dwg multi_color_mtext ISOCPEURI also attached a sample workspace. 

View original
Did this help you find an answer to your question?

2 replies

caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • Best Answer
  • March 2, 2023

Autocad sets color in mtext via \Ccolor_number in strings and font via \fFONT_NAME.

Using this in LabelPointReplacer:

\C3;How now green cow
\C7;How now black cow
\C5;How now blue cow

gives this result:

dwg multi_color_mtextThis string in LabelPointReplacer:

\fISOCPEUR|b0|i0;\C3;How now green cow
\C7;How now black cow
\C5;How now blue cow

gives this result:

dwg multi_color_mtext ISOCPEURI also attached a sample workspace. 


kdwss
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • March 2, 2023
caracadrian wrote:

Autocad sets color in mtext via \Ccolor_number in strings and font via \fFONT_NAME.

Using this in LabelPointReplacer:

\C3;How now green cow
\C7;How now black cow
\C5;How now blue cow

gives this result:

dwg multi_color_mtextThis string in LabelPointReplacer:

\fISOCPEUR|b0|i0;\C3;How now green cow
\C7;How now black cow
\C5;How now blue cow

gives this result:

dwg multi_color_mtext ISOCPEURI also attached a sample workspace. 

You've solved my problem. Thank  you!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings