PDA

View Full Version : Create MTEXT with Lisp



jjacoby
2005-11-09, 12:55 PM
I am trying to create MTEXT using “entmake” in my lisp routine. The routine is list below, please look at this routine and please point me in the right direction.

Thank you



(defun C:PARKING ()
(setq |CMDECHO| (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setvar "osmode" 512)
(setq PT1 (getpoint "Select mid point of text: "))
(setq PT2 (getpoint "\nSelect direction of text: "))
;;;Text data
(setq TAG (strcat "ASPHALT PARKING LOT" ))
(setq ang (angle PT1 PT2))
;;;TEXT TO PRINT ON SCREEN
(entmake (list
(cons 0 "MTEXT")
;;; (cons 100 "ACDDMTEXT")
(cons 7 "LEROY")
(cons 8 "E_TEXT_L080")
(cons 71 2)
(cons 72 5)
(cons 73 1)
(cons 10 PT1)
(cons 50 ANG)
(cons 41 19.35)
(cons 40 (* (getvar "dimscale") 0.08))
(cons 1 (princ TAG))
)
)
(setvar "osmode" 0)
(setvar "cmdecho" 1)
(redraw)
(princ)
)

[ Moderator Action = ON ] What are [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code) [ Moderator Action = OFF ]

fixo
2005-11-09, 01:33 PM
Hi jjacoby

Try this one:



(defun C:PARKING ()
(setq |CMDECHO| (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setvar "osmode" 512)
(setq PT1 (getpoint "Select mid point of text: "))
(setq PT2 (getpoint pt1 "\nSelect direction of text: "))
;;;Text data
(setq TAG (strcat "ASPHALT PARKING LOT" ))
(setq ang (angle PT1 PT2))
;;;TEXT TO PRINT ON SCREEN
(entmake (list
(cons 0 "MTEXT")
(cons 100 "AcDbEntity")
(cons 100 "AcDbMText")
(cons 7 "LEROY")
(cons 8 "E_TEXT_L080")
(cons 71 5)
(cons 72 5)
(cons 73 1)
(cons 10 PT1)
(cons 11 (list 1.0 0.0 0.0))
(cons 50 ANG)
(cons 41 19.35)
(cons 40 (* 19.35 (strlen TAG)))
(cons 44 1.0)
(cons 1 TAG)
)
)
(setvar "osmode" 0)
(setvar "cmdecho" 1)
(redraw)
(princ)
)


Thank you

f.