   Ŀ
                                                                          
              ACAD'te AutoLisp ile                                          
                                  YAY izme                                 
                                                 - Hasan ada -         
   



   Dkm verilen AutoLisp program, YAYOLC ve YAYCIZ isimli iki fonksiyon
    ierir.

   YAYOLC, izilmi bir yay parasnn uzunluunu hesaplamak,

   YAYCIZ ise uzunluk bildirilerek yay izilmesi iin kullanlr.


    Elemanlarn nitelik bilgilerini kullanarak hesaplamalar yapan bir rnek.


   Program iletmek iin, AutoCAD Command iletisinde;

             Command: (load"yay")

    cmlesini kullanp program ykledikten sonra, fonksiyon isimlerini
    komut olarak kullanabilirsiniz.





; YAY.LSP
; Hasan ADA 1989

(defun C:YAYOLC(/ bulk s rad stang endang alfa mes)

       (print "Only ARC")
       (setq s (ssget))                    ; Select object (arc)
       (setq bulk (entget (entlast)))      ; Bulk = dblist of arc
       (ssdel (entlast) s)                 ; Delete entitie
       (setq rad (assoc 40 bulk))          ; Rad= radius of arc
       (setq stang (assoc 50 bulk))        ; Stang= start angle of arc
       (setq endang (assoc 51 bulk))       ; Endang= end angle of arc
       (setq stang (cdr stang))            ; Stang= convert string to real
       (setq endang (cdr endang))          ; Endang= convert string to real
       (setq rad (cdr rad))                ; Rad= convert real & ignored
                                                  ; first element
       (setq alfa (abs (- endang stang)))  ; Alfa= angle of arc
       (setq mes (* alfa rad))             ; Mes= lenght of arc
                                                  ; (radianalfa * radius)
       (setq mes (rtos mes 2 8))           ; Mes= units selection
                                                  ; (8 decimal place)
       (prompt "Lenght of arc : ")         ; Print lenght of arc
       (prompt mes)
       (terpri)
)

(defun C:YAYCIZ(/ cen str len rdi dumy ang )

   (setq cen (getpoint "Center point:" ))    ; Input center point of arc
   (setq str (getpoint "Start point:" ))     ; Input start point of arc
   (setq rdi (distance cen str ))            ; Calculate radius distance
   (setq len (getreal "Lenght of arc:"))     ; Input lenght of arc
   (setq ang (/ (* len 360) (* 2 pi rdi )))  ; Calculation angle of arc
                                               ; ((lenght 360) / (2r))
   (command "ARC" "C" cen str "A" ang)       ; Drawing arc ( C,S,A format )
   (terpri)
)