- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good morning,
I have an old lisp that inserts text on a line at the rotation of the line but I can't figure out how to do the same thing with MTEXT. What I am wanting is it to insert the MTEXT on the line at the rotation of the line but also have the background mask of the MTEXT turned on. The new text also doesn't need to break the line but that isn't my biggest problem.
As a place to start I tried to change the line: (command "TEXT" "M" "NEA" P1 A2 TX)
to this: (COMMAND "_MTEXT" P1 "J" "MC" "R" A2 "W" 0 TX)
just to get the mtext part in there but I keep getting an error of "bad argument type: 2d/3d point: nilmtext:" if i just hit enter it inserts the mtext but I can't figure out what I'm doing wrong to get that error or how to add the background mask into it.
Thanks everyone!
Here is the orginal lisp:
"
;;; INSERTS TEXT ON LINE
(defun C:Ty (/ A1 A2 A3 E1 E2 E3 ENTNA LASTX OS1 P1 P4 P5 P6 P7 P8 P9 TX TX1)
(command "-color" "231")
(SETQ OLDL (GETVAR "CLAYER"))
(setq OS1 (getvar "osmode"))
(setvar "osmode" 512)
(if (or (nULL txold) (= txold ""))
(setq txold "1")
)
(setq TX (getstring (strcat "\nEnter text <" txold ">: ")))
(if (or (nULL tx) (= tx ""))
(setq tx TXOLD)
)
(setq txold tx)
(while (setq E1 (entsel "\nSelect Line: "))
(setq E2 (entget (car E1)))
(setq lay (cdr (assoc 8 E2)))
(command "-layer" "s" lay "")
(setq E3 (cdr (assoc 0 E2)))
(setq P1 (cadr E1))
(if (= E3 "POLYLINE")
(setq P2 (cadr E1)
P3 (getpoint "\nPick point for rotation: "))
(if (= E3 "CIRCLE")
(setq P2 (cadr E1)
P3 (cdr (assoc 10 E2)))
(if (= E3 "ARC")
(setq P2 (cadr E1)
P3 (cdr (assoc 10 E2)))
(setq P2 (cdr (assoc 10 E2))
P3 (cdr (assoc 11 E2)))
)
)
)
(if (= E3 "CIRCLE")
(setq A1 (+ (angle P2 P3) (/ pi 2)))
(if (= E3 "ARC")
(setq A1 (+ (angle P2 P3) (/ pi 2)))
(setq A1 (angle P2 P3))
)
)
(if
(and
(> A1 (/ pi 2))
(<= A1 (* pi 1.5))
)
(setq A1 (+ A1 pi))
)
(setq A2 (angtos A1 0 4))
(command "TEXT" "M" "NEA" P1 A2 TX)
(setq LASTX (entget (entlast)))
(setq TX1 (textbox LASTX))
(setq P4 (car TX1))
(setq P5 (cdr TX1))
(setq P5 (car P5))
(setq P6 (distance P4 P5))
(setq P7 (+ (/ P6 2) (* 0.04 (/ 1 (getvar 'cannoscalevalue)))))
(setq A3 (- A1 pi))
(setq p8 (polar P1 A1 P7))
(setq p9 (polar P1 A3 P7))
(command "ERASE" "L" "")
(command "BREAK" P1 "F" P8 P1)
(command "BREAK" P1 P9)
(command "OOPS")
)
(SETVAR "CLAYER" OLDL)
(setvar "osmode" OS1)
(command "-color" "BYLAYER")
(princ)
)"
Solved! Go to Solution.