(defun c:rad ()
(setvar "orthomode" 0)
(setvar "osmode" 512)
(setq pig (getpoint "\nPick a radius or circle to mark dimension"))
(setvar "osmode" 0)
(setq rt (ssget pig))
(setq rt (ssname rt 0))
(setq rt (entget rt))
(setq rtd1 (strcat "R" (rtos (cdr (assoc 40 rt)) 2 2)))
(set_layer dim)
(prompt "\nlinder second point:")
(command "line" pig pause "")
(setq pi1 (getvar "lastpoint"))
(setvar "orthomode" 1)
(prompt "\nlinder second point:")
(command "line" "" pause "")
(setq pi2 (getvar "lastpoint"))
(setq ang (angtos (angle pig pi1) 0 2))
(setq sca (getvar "dimscale"))
(setq a1 (car pi2) a2 (car pi1) a3 (cadr pi2) a4 (cadr pi1))
(if (> (abs (- a1 a2)) (abs (- a3 a4)))
(setq pi3 (list a1 a4))
(setq pi3 (list a2 a3))
)
(setq dis (* (getvar "dimscale") 1.8))
(command "insert" "*arr" pig sca ang)
(if (> (- a1 a2) 0)
(command "text" "j" "ml" (polar pi3 (angle pi1 pi3) dis) "" "0" rtd1)
(command "text" "j" "mr" (polar pi3 (angle pi1 pi3) dis) "" "0" rtd1)
))
