Author Topic: Underlined Mtext  (Read 8983 times)

0 Members and 1 Guest are viewing this topic.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Underlined Mtext
« Reply #15 on: February 04, 2010, 11:27:34 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)
                    [color=red](cons 7 "ROMANS")[/color]
                    (cons 1 val))))

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

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

  (princ))

Thank you very much.
By learning your code, I read DXF section in the HELP & add a line the your code allowing to change the text style.  :-)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Underlined Mtext
« Reply #16 on: February 04, 2010, 11:45:21 PM »
good job.
You can also set the layer and if needed the color override.
Do you see which DXF codes do that?
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 #17 on: February 05, 2010, 11:49:47 AM »

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Underlined Mtext
« Reply #18 on: February 05, 2010, 10:27:25 PM »
good job.
You can also set the layer and if needed the color override.
Do you see which DXF codes do that?


Not sure if the following correct:

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 7 "ROMANS")
                    (cons 1 val))
    ); end of entmakex
    [color=red](entmakex (list (cons 0 "LAYER")
  (cons 2 "Layer_Mtext")) ; set mtext's layer to "Layer_Mtext" if it exists.
    ); end of entmakex[/color]
)
  (if (setq pt (getpoint "\nSpecify Point: "))
    (progn
      (setq str (getstring t "\nSpecify Text: "))

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

Thanks.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Underlined Mtext
« Reply #19 on: February 05, 2010, 10:29:48 PM »
Nice one  :-)

This may help you  :-)

http://autodesk.com/techpubs/autocad/acad2000/dxf/

Thanks for the link.
PS. Is there a 2010 version available in autodesk's web?
I can find it there.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Underlined Mtext
« Reply #20 on: February 05, 2010, 11:18:08 PM »
Not quite. The benefit of using entmake is that if the layer does not exist it will create it without your help.

Try this:
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 7 "ROMANS")
                    (cons 8 "Layer_Mtext")
                    (cons 1 val))
    ); end of entmakex

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

      (M-Text pt (strcat "{\\L" str "}"))))
(princ)
)
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.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Underlined Mtext
« Reply #21 on: February 05, 2010, 11:30:32 PM »

Thanks for the link.
PS. Is there a 2010 version available in autodesk's web?
I can find it there.

Try this :-

http://images.autodesk.com/adsk/files/acad_dxf1.pdf
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Underlined Mtext
« Reply #22 on: February 06, 2010, 01:21:25 AM »
Not quite. The benefit of using entmake is that if the layer does not exist it will create it without your help.

Try this:
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 7 "ROMANS")
                    (cons 8 "Layer_Mtext")
                    (cons 1 val))
    ); end of entmakex

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

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

Sorry, I confuse with the DXF group codes.
I use the (cons 2 "Layer_Mtext") because I found "2" under the layer section.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Underlined Mtext
« Reply #23 on: February 06, 2010, 01:28:56 AM »

Thanks for the link.
PS. Is there a 2010 version available in autodesk's web?
I can find it there.

Try this :-

http://images.autodesk.com/adsk/files/acad_dxf1.pdf

Thanks for your help. I opened the file.
I am trying to get more resources from Autodesk web.
I did a search again but can't find a page in the Autodesk web showing the entry to the DXF Reference file.
Can you show me the page?
Thanks again.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Underlined Mtext
« Reply #24 on: February 06, 2010, 02:09:49 AM »


http://usa.autodesk.com/adsk/servlet/ps/item?siteID=123112&id=2882295&linkID=9240617

Have you tried your local Help files ?  :-

C:\Program Files\Autodesk\ACAD 2010\Help\acad_dxf.chm
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Underlined Mtext
« Reply #25 on: February 06, 2010, 07:12:49 AM »
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 #26 on: February 06, 2010, 08:39:27 AM »
Not quite. The benefit of using entmake is that if the layer does not exist it will create it without your help.

Try this:
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 7 "ROMANS")
                    (cons 8 "Layer_Mtext")
                    (cons 1 val))
    ); end of entmakex

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

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

Sorry, I confuse with the DXF group codes.
I use the (cons 2 "Layer_Mtext") because I found "2" under the layer section.

When aiming to modify/set the properties for an entity, just look at the entity dxf group codes - these are all that you need. The layer dxf codes would be used to create/modify a layer.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Underlined Mtext
« Reply #27 on: February 08, 2010, 06:23:31 PM »


http://usa.autodesk.com/adsk/servlet/ps/item?siteID=123112&id=2882295&linkID=9240617

Have you tried your local Help files ?  :-

C:\Program Files\Autodesk\ACAD 2010\Help\acad_dxf.chm

Thanks.
Yes, I know the local built in one but was thinking it would be helpful if there is one in pdf form.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Underlined Mtext
« Reply #28 on: February 08, 2010, 06:26:17 PM »
Don't forget to visit this thread:
http://www.theswamp.org/index.php?topic=24700.msg359343#msg359343
You are the biggggggg man.
Thanks for the useful/helpful resources.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Underlined Mtext
« Reply #29 on: February 08, 2010, 06:29:02 PM »
...
When aiming to modify/set the properties for an entity, just look at the entity dxf group codes - these are all that you need. The layer dxf codes would be used to create/modify a layer.

Thanks. you are right.