;;; Rotate selected text by example Text Source Rotation
;;; Created by Kent Cooper
;;; Saved from: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-match-the-text-rotation-only/td-p/1254583

(defun C:TR (/ tsel tdata ss ml rot tobj); = Match Text Rotation
(vl-load-com)
(if
(and
(setq tsel (entsel "\nSelect Text Source for Rotation: "))
(wcmatch (cdr (assoc 0 (setq tdata (entget (car tsel))))) "*TEXT,MULTILEADER")
(setq ss (ssget '((0 . "*TEXT,MULTILEADER"))))
); and
(progn
(setq
ml (member '(0 . "MULTILEADER") tdata)
rot (cdr (assoc (if ml 42 50) tdata))
); setq
(repeat (setq n (sslength ss))
(setq
tobj (vlax-ename->vla-object (ssname ss (setq n (1- n))))
ml (= (vla-get-ObjectName tobj) "AcDbMLeader")
); setq
(vlax-put tobj (if ml 'TextRotation 'Rotation) rot)
); repeat
); progn
); if
(princ)
); defun
(c:tr)

Advertisements