;;; Offset selected Texts and Mtexts to orthogonal directions with user specified distance
;;; Created by Tharwat 17. 06. 2011
;;; Saved from: http://www.cadtutor.net/forum/archive/index.php/t-60238.html?s=b89acc4f7788518cdf276f1576bb2791

(defun c:tof (/ ss rep dis i ssNme p)
(vl-load-com)
; Tharwat 17. 06. 2011
(if
(and (setq ss (ssget "_:L" '((0 . "TEXT,MTEXT"))))
(progn (initget "Left Right Up Down")
(setq rep
(getkword "\n Specify the Direction [Left/Right/Up/Down]:"
)
)
)
(setq dis (getdist "\n Specify the Distance :"))
)
(cond ((eq rep "Left")
(repeat
(setq i (sslength ss))
(setq ssNme (ssname ss (setq i (1- i))))
(vla-move
(vlax-ename->vla-object ssNme)
(vlax-3d-point (setq p (cdr (assoc 10 (entget ssNme)))))
(vlax-3d-point (list (- (car p) dis) (cadr p)))
)
)
)
((eq rep "Right")
(repeat
(setq i (sslength ss))
(setq ssNme (ssname ss (setq i (1- i))))
(vla-move
(vlax-ename->vla-object ssNme)
(vlax-3d-point (setq p (cdr (assoc 10 (entget ssNme)))))
(vlax-3d-point (list (+ (car p) dis) (cadr p)))
)
)
)
((eq rep "Up")
(repeat
(setq i (sslength ss))
(setq ssNme (ssname ss (setq i (1- i))))
(vla-move
(vlax-ename->vla-object ssNme)
(vlax-3d-point (setq p (cdr (assoc 10 (entget ssNme)))))
(vlax-3d-point
(list (car p) (+ (cadr p) dis))
)
)
)
)
((eq rep "Down")
(repeat
(setq i (sslength ss))
(setq ssNme (ssname ss (setq i (1- i))))
(vla-move
(vlax-ename->vla-object ssNme)
(vlax-3d-point (setq p (cdr (assoc 10 (entget ssNme)))))
(vlax-3d-point
(list (car p) (- (cadr p) dis))
)
)
)
)
)
(princ)
)
(princ)
)
(c:tof)

Advertisements