multiline text

multiline text

Anonymous
Not applicable
2,252 Views
1 Reply
Message 1 of 2

multiline text

Anonymous
Not applicable

Hi

 

I am really struggling to find info on how to work with multiline text with lisp? Please can somebody point me to some documentation or something? Or at least just explain how I would create multiline text?

 

Cheers

 

Derryck

0 Likes
Accepted solutions (1)
2,253 Views
1 Reply
Reply (1)
Message 2 of 2

dennis
Advisor
Advisor
Accepted solution

A great source is the website of a fella that you will see in threads here.

http://www.lee-mac.com/index.html

Lee Mac even has a nice search engine for his code as well.

CADTutor is another:  http://www.cadtutor.net/

 

(defun c:mymtext (/ txtstr pt)
  (if (and (not (eq (setq txtstr (getstring t "\nEnter a really long sentence: ")) ""))
       (setq pt (getpoint "\nPick the insertion point for the text:"))
      )
    (entmake (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText")
           (cons 10 p)
           (cons 40 (* (getvar "DIMSCALE") 2.0))
           (cons 7 (if (tblsearch "STYLE" "Standard")  "Standard"   "Standard" ))
           (cons 1 txtstr)
         )
    )
  )
  (princ)
)

The if / and tests the entry to make sure it isn't just a return and that txtstr is set to something.

Copy / paste the code into the AutoCAD Visual Lisp Editor, found on the Manage Tab.

From the there, you can use the Tools / Load Text in Editor to test.

Once happy, save the LSP file and put it in your Startup Suite, or save to AcadDoc.Lsp to load it automatically (which needs to be in the Support Paths or current drawing folder), or manually load at the command line: (load "Filename.LSP")