Author Topic: Radial Checker not working...  (Read 1800 times)

0 Members and 1 Guest are viewing this topic.

DanB

  • Bull Frog
  • Posts: 367
Radial Checker not working...
« on: May 04, 2005, 08:26:40 AM »
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

Code: [Select]

;;
;; 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)
  )

SMadsen

  • Guest
Radial Checker not working...
« Reply #1 on: May 04, 2005, 09:18:51 AM »
Try (equal ang1 ang2 0.001) instead of (= ang1 ang2) and see if it makes a difference.

DanB

  • Bull Frog
  • Posts: 367
Radial Checker not working...
« Reply #2 on: May 04, 2005, 10:44:47 AM »
Thanks, I went a bit farther with the precision and it does seem to be working now.