Hello,
I wanted a routine to move text along its rotation angle so I came up with an easy solution using the move command. How would I do this without the move command but still see the text move in real time as I drag it along?
Thanks.
(defun nss:slide_text ( / *error* oom osa oos oce te en)
;;;=============================================================================
;;; A text slide function making use of ortho and snapang with move command.
;;;=============================================================================
;;;=========================================================================
;; Define the local error handler
(defun *error* (msg)
;; Reset system variables to user values
(if oom (setvar "ORTHOMODE" oom))
(if osa (setvar "SNAPANG" osa))
(if oos (setvar "OSMODE" oos))
(if oce (setvar "CMDECHO" oce))
;; Make sure the entity is not highlighted
(if en (redraw (car en) 4))
)
;;;=========================================================================
;; Get user to select a text or mtext
(while (not te)
(if (setq en (entsel "Select text to slide: "))
(cond
((wcmatch (cdr (assoc 0 (setq te (entget (car en))))) "*TEXT")
te)
(T
(setq te NIL)))))
;; Save the user's preferences for the system variables
(setq oom (getvar "ORTHOMODE"))
(setq osa (getvar "SNAPANG"))
(setq oos (getvar "OSMODE"))
(setq oce (getvar "CMDECHO"))
;; Set snapang to text rotation, ortho on, cmdecho off and osmode off
(setvar "ORTHOMODE" 1)
(setvar "SNAPANG" (cdr (assoc 50 te)))
(setvar "OSMODE" 0)
(setvar "CMDECHO" 0)
;; Run the move command with a pause for the displacement point
(command "_MOVE" (cdr (assoc -1 te)) "" (cadr en) pause)
(while (> (getvar "CMDACTIVE") 0)
(command pause))
;; Restore the system variables to user's settings.
(setvar "ORTHOMODE" oom)
(setvar "SNAPANG" osa)
(setvar "OSMODE" oos)
(setvar "CMDECHO" oce)
;; Exit quietly
(prin1)
)
;;;=============================================================================