Author Topic: Underlined Mtext  (Read 8988 times)

0 Members and 1 Guest are viewing this topic.

MeasureUp

  • Bull Frog
  • Posts: 462
Underlined Mtext
« on: February 02, 2010, 10:08:40 PM »
How to write underlined mtext by using lisp?
Thanks in advance.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Underlined Mtext
« Reply #1 on: February 02, 2010, 10:15:44 PM »
Perhaps the answer you seek is HERE
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Underlined Mtext
« Reply #2 on: February 03, 2010, 01:14:25 AM »
Perhaps the answer you seek is HERE
Thanks for your help.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Underlined Mtext
« Reply #3 on: February 03, 2010, 08:39:44 AM »
You're welcome.
Did you find the information you needed?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Underlined Mtext
« Reply #4 on: February 03, 2010, 08:59:19 AM »
Code: [Select]
[color=RED]{\\L[/color]This text is Underlined[color=RED]}[/color]

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Underlined Mtext
« Reply #5 on: February 03, 2010, 01:48:13 PM »
Simply add \\u to the text string, let's say your text is in a variable called TEXT
(setq TEXT (strcat "\\u" TEXT))
should do the trick.

Joe Burke

  • Guest
Re: Underlined Mtext
« Reply #6 on: February 04, 2010, 07:39:34 AM »
To underdline a text object add %%u.

But the question was how to underline an mtext object.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Underlined Mtext
« Reply #7 on: February 04, 2010, 06:08:30 PM »
Code: [Select]
[color=RED]{\\L[/color]This text is Underlined[color=RED]}[/color]

Simply add \\u to the text string, let's say your text is in a variable called TEXT
(setq TEXT (strcat "\\u" TEXT))
should do the trick.

Unlike underlining TEXT, the prefix "\\L" doesn't do the trick for MTEXT.
Thanks.
« Last Edit: February 04, 2010, 06:12:01 PM by MeasureUp »

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Underlined Mtext
« Reply #8 on: February 04, 2010, 06:13:19 PM »
To underdline a text object add %%u.

But the question was how to underline an mtext object.

Yes, you know what I mean.
Thanks.

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Underlined Mtext
« Reply #9 on: February 04, 2010, 06:13:27 PM »
Seems to work for me  :?

Code: [Select]
(defun c:MakeThatMTextUnderlined (/ ent obj)
  (vl-load-com)

  (if (and (setq ent (car (entsel "\nSelect MText: ")))
           (eq "MTEXT" (cdr (assoc 0 (entget ent)))))

    (vlax-put-property
      (setq obj (vlax-ename->vla-object ent)) 'TextString
        (strcat "{\\L"
          (vlax-get-property obj 'TextString) "}")))

  (princ))

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Underlined Mtext
« Reply #10 on: February 04, 2010, 06:22:24 PM »
You're welcome.
Did you find the information you needed?


Hi CAB,
Yes, I have read ervery threads which you linked.
They are helpful. Thanks.
Another question raised after reading the info you linked:
How to customise a mtext in leader?
For example, write an underline mtext and/or set up text style in leader.
Thanks again.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Underlined Mtext
« Reply #11 on: February 04, 2010, 06:26:42 PM »
Seems to work for me  :?

Code: [Select]
(defun c:MakeThatMTextUnderlined (/ ent obj)
  (vl-load-com)

  (if (and (setq ent (car (entsel "\nSelect MText: ")))
           (eq "MTEXT" (cdr (assoc 0 (entget ent)))))

    (vlax-put-property
      (setq obj (vlax-ename->vla-object ent)) 'TextString
        (strcat "{\\L"
          (vlax-get-property obj 'TextString) "}")))

  (princ))

Thank you very much.
This is very nice when underlining an existing MTEXT.

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Underlined Mtext
« Reply #12 on: February 04, 2010, 06:29:43 PM »
Seems to work for me  :?

Code: [Select]
(defun c:MakeThatMTextUnderlined (/ ent obj)
  (vl-load-com)

  (if (and (setq ent (car (entsel "\nSelect MText: ")))
           (eq "MTEXT" (cdr (assoc 0 (entget ent)))))

    (vlax-put-property
      (setq obj (vlax-ename->vla-object ent)) 'TextString
        (strcat "{\\L"
          (vlax-get-property obj 'TextString) "}")))

  (princ))

Thank you very much.
This is very nice when underlining an existing MTEXT.


Is that what you were after? Or was it something else?

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Underlined Mtext
« Reply #13 on: February 04, 2010, 06:36:55 PM »
Seems to work for me  :?

Code: [Select]
(defun c:MakeThatMTextUnderlined (/ ent obj)
  (vl-load-com)

  (if (and (setq ent (car (entsel "\nSelect MText: ")))
           (eq "MTEXT" (cdr (assoc 0 (entget ent)))))

    (vlax-put-property
      (setq obj (vlax-ename->vla-object ent)) 'TextString
        (strcat "{\\L"
          (vlax-get-property obj 'TextString) "}")))

  (princ))

Thank you very much.
This is very nice when underlining an existing MTEXT.


Is that what you were after? Or was it something else?

Origenally, I want to write underlined MTEXT by using AutoLisp.
Thanks again.

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Underlined Mtext
« Reply #14 on: February 04, 2010, 07:47:48 PM »
Origenally, I want to write underlined MTEXT by using AutoLisp.
Thanks again.

Code: [Select]
(defun c:test (/ M-Text pt str)

  (defun M-Text (pt val)
    (entmakex (list (cons 0 "MTEXT")
                    (cons 100 "AcDbEntity")
                    (cons 100 "AcDbMText")
                    (cons 10 pt)
                    (cons 1 val))))

  (if (setq pt (getpoint "\nSpecify Point: "))
    (progn
      (setq str (getstring t "\nSpecify Text: "))

      (M-Text pt (strcat "{\\L" str "}"))))

  (princ))