I wanted a quick way to verify whether Parcel Lot lines had been drawn radial to Arc boundaries, so I wrote up this code. I'm not sure what I am overlooking but it does not always give the expected output under testing controlled conditions (i.e. I drew the line radial and the lisp claims otherwise). Any suggestions?...
Thanks in advance,
Dan
;;
;; CHECK RADIAL BEARING OF SELECTED LINES AND ARC
;; By Dan B and Jeff K
;; April 2005
;;
(defun c:RAD (/ oldecho oldos arc_ent arc_xent arc_list cpt line_ent line_xent line_list stpt endpt ang1 ang2 )
;;
(setq oldecho (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq oldos (getvar "osmode"))
(setvar "osmode" 0)
;;
(setq arc_ent (car (setq arc_xent (entsel "\nSelect Arc: "))))
(setq arc_list (entget (car arc_xent))) ; entity list
(setq cpt (cdr (assoc 10 arc_list))) ; center point
;;
(setq line_ent (car (setq line_xent (entsel "\nSelect Line: "))))
(setq line_list (entget (car line_xent))) ; entity list
(setq stpt (cdr (assoc 10 line_list))) ; start point of line
(setq endpt (cdr (assoc 11 line_list))) ; end point of line
;;
(setq ang1 (angle cpt stpt))
(setq ang2 (angle cpt endpt))
(setq str1 (strcat "\nAngle 1 is (radians): " (rtos ang1 2 2) ))
(princ str1)
(setq str2 (strcat "\nAngle 2 is (radians): " (rtos ang2 2 2) ))
(princ str2)
(if (= ang1 ang2)
(prompt "\n* Line is RADIAL to Arc *")
(alert "\nLine is NOT Radial to Arc!")
) ; end if
;;
(setvar "osmode" oldos)
(setvar "cmdecho" oldecho)
(princ)
)