Note that you'll need to check that DXF groups 72 & 73 are
both zero (i.e. for Left justified text) in order to ascertain whether you should use DXF group 10 or DXF group 11 as the base point for the rotation. You may also want to verify that the user has indeed selected a
TEXT object, as opposed to any other object, and provide the user with a way to exit the program at the selection prompt, without needing to press
ESC and force an error (though, admittedly, a clean exit is not possible whilst pausing for input within the
ROTATE command).
I might be inclined to write the function in the following way:
(defun rotate_txt
( / ent enx
) ;; Define function, declare local variables (while ;; While the following expression returns a non-nil value (progn ;; Evaluate the following expressions and return the value returned by the last evaluated expression (setvar 'errno
0) ;; Clear the ERRNO system variable (setq ent
(car (entsel "\nSelect text to rotate: "))) ;; Prompt the user for a selection (cond ;; Evaluate the following test expressions until an expression returns a non-nil value ( (= 7 (getvar 'errno
)) ;; User selected empty space (princ "\nMissed, try again.") ;; Stay in loop )
( (null ent
) ;; User dismissed the prompt nil ;; Exit loop
)
(princ "\nThe selected object is not a single-line text object.") ;; Stay in loop )
"_R"
"\\" ;; Safer than using pause
) ;; end command
)
) ;; end cond
) ;; end progn
) ;; end while
(princ) ;; Suppress the value returned by the last evaluated expression ) ;; end defun