Hi guys!
I have this modified routine for placing text in PS giving the scale of a selected viewport.
It works fine, but was wondering if this can be done by reactors, so that if the scale of the viewport is changed, the text updates with it?
I have absolutely no idea about reactors. Is anyone kind enough to share a reactor if they have one that does this function? ;o)
Many thanks,
..::KIEREN::..
Code:
;;--------------------------------------
(defun c:getvpscale (/ ent elist vpscale)
(setq clay (getvar "clayer"))
(setq ent (car (entsel "\nSelect viewport: ")))
(if ent
(progn
(setq elist (entget ent))
(cond ((= (cdr (assoc 0 elist)) "VIEWPORT") t)
((and (= (cdr (assoc 0 elist)) "LWPOLYLINE")
(assoc 330 elist)
)
(setq elist (entget (cdr (assoc 330 elist))))
)
(t (princ "\nNot a valid viewport object....")(setq elist nil)))
(if elist (setq vpscale (/ (cdr (assoc 45 elist)) (cdr (assoc 41elist)))))
)
)
(princ "\nPosition text.....")
(setvar "cmdecho" 0)
(setq sst (strcat "Scale=1:"(rtos vpscale 2 0)))
(setq clay (getvar "clayer"))
(if (= (tblsearch "layer" "Z000T-ScaleText") nil)
(command "layer" "m" "Z000T-ScaleText" "c" "4" "" "")
(command "layer" "s" "Z000T-ScaleText" "")
)
(command ".text" "j" "m" pause 3 0 sst)
(if vpscale
(princ (strcat "\nActual Vpscale (3 dec places)= 1:" (rtos vpscale 2 3)))
(princ "\nNothing selected.....")
)
(setvar "clayer" clay)
(princ)
)
;;--------------------------------------------------