Code Red > AutoLISP (Vanilla / Visual)

Setting Color for 2nd Character in Mtext

(1/2) > >>

MeasureUp:
As the title mentioned I want to set color (other than the default) for the 2nd character in mtext that I am creating.
I don't find anything that can do the setting for individual character from the group codes of entmake for mtext.
Your helps are much appreciated.

d2010:
Sărbătoarea Aducerii moaștelor Sfântului Ierarh Ioan Gură de Aur

BIGAL:
You may need to entmake the mtext as a dummy text "a" then use vl-put-textstring with the correct coding of the top of my head "a{\\C1b}cdef"

The "b" will be red.

MeasureUp:
Sorry, I don't get it.
Here is a simple code.


--- Code: ---(defun c:MyMessage (/ GetMessage InsertPoint)

(setq GetMessage (getstring T "Enter Message: "))

; As an example the message is "R+ will be added on Level 2."
; How to set the 2nd character color as yellow?

(setq InsertPoint (getpoint  "Insert Message"))

(entmake
(list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") (cons 1 GetMessage) (cons 10 InsertPoint) (cons 40 25))
); end of entmake

); end of code

--- End code ---

Thanks.

Tharwat:
Here you go.


--- Code - Auto/Visual Lisp: ---(defun c:MyMessage (/ GetMessage InsertPoint two)  (and (/= "" (setq GetMessage (getstring T "\nEnter Message: ")))       (setq InsertPoint (getpoint "\nInsert Message"))       (or (and (> (strlen GetMessage) 1)                (/= (setq two (substr GetMessage 2 1)) " ")                (setq GetMessage                       (strcat (substr GetMessage 1 1)                               "{\\C2;"                               two                               "}"                               (substr GetMessage 3)                       )                )           )           GetMessage       )       (entmake (list '(0 . "MTEXT")                      '(100 . "AcDbEntity")                      '(100 . "AcDbMText")                      (cons 1 GetMessage)                      (cons 10 InsertPoint)                      (cons 40 25)                )       )  )  (princ)) 

Navigation

[0] Message Index

[#] Next page

Go to full version