(defun c:RING1()
; (IF (= (TYPE F1) 'FILE ) "YES"  (STOP))
; (IF (= (TYPE F2) 'FILE ) "YES" (STOP))
 (COMMAND "SETVAR" "CMDECHO" 0)
 (SETQ NY (GETVAR "CLAYER"))
 (setq BLSET (findfile "C:/ACAD/HON/SET/RING1.SET"))
 (IF (= BLSET NIL)
     (PROGN
        (SETQ TEST 1)
        (PROMPT "\nPLEASE SETTING LAYER:" )
        (SETQ FC (OPEN "C:/ACAD/HON/SET/RING1.SET" "w"))
        (setq BLCNT (GETSTRING T"\nSETTING LAYER OF CONTNIUE LINE/<0>:"))
        (IF (= BLCNT "")
               (WRITE-LINE "0" FC)
               (WRITE-LINE BLCNT FC)
        )
        (setq BLCEN (GETSTRING T"\nSETTING LAYER OF CENTER LINE/<CEN>:"))
        (IF (= BLCEN "")
               (WRITE-LINE "CEN" FC)
               (WRITE-LINE BLCEN FC)
        )
        (setq BLHID (GETSTRING T"\nSETTING LAYER OF HIDDEN LINE/<HID>:"))
        (IF (= BLHID "")
               (WRITE-LINE "HID" FC)
               (WRITE-LINE BLHID FC)
        )
        (setq BLDIM (GETSTRING T"\nSETTING LAYER OF DIMESION /<DIM1>:"))
        (IF (= BLDIM "")
               (WRITE-LINE "DIM1" FC)
               (WRITE-LINE BLDIM FC)
        )
        (setq BLTXT (GETSTRING T"\nSETTING LAYER OF TEXT /<TEXT>:"))
        (IF (= BLTXT "")
               (WRITE-LINE "TEXT" FC)
               (WRITE-LINE BLTXT FC)
        )
        (CLOSE FC)
     )
 )

 (IF (/= BLSET NIL)
     (PROGN
        (SETQ FC (OPEN "C:/ACAD/HON/SET/RING1.SET" "r"))
        (SETQ BLCNT (READ-LINE FC))
        (SETQ BLCEN (READ-LINE FC))
        (SETQ BLHID (READ-LINE FC))
        (SETQ BLDIM (READ-LINE FC))
        (SETQ BLTXT (READ-LINE FC))
        (IF (OR (= BLCNT "") (= BLCEN "") (= BLHID "") (= BLDIM "") (= BLTXT "")
                (= BLCNT NIL) (= BLCEN NIL) (= BLHID NIL) (= BLDIM NIL) (= BLTXT NIL))
            (CLOSE FC)
        )
        (IF (OR (= BLCNT "") (= BLCEN "") (= BLHID "") (= BLDIM "") (= BLTXT "")
                (= BLCNT NIL) (= BLCEN NIL) (= BLHID NIL) (= BLDIM NIL) (= BLTXT NIL))
            (PROGN
               (PROMPT "\nPLEASE SETTING LAYER:" )
               (SETQ FC (OPEN "C:/ACAD/HON/SET/RING1.SET" "w"))
               (setq BLCNT (GETSTRING T"\nSETTING LAYER OF CONTNIUE LINE/<0>:"))
               (IF (= BLCNT "")
                   (WRITE-LINE "0" FC)
                   (WRITE-LINE BLCNT FC)
               )
               (setq BLCEN (GETSTRING T"\nSETTING LAYER OF CENTER LINE/<CEN>:"))
               (IF (= BLCEN "")
                   (WRITE-LINE "CEN" FC)
                   (WRITE-LINE BLCEN FC)
               )
               (setq BLHID (GETSTRING T"\nSETTING LAYER OF HIDDEN LINE/<HID>:"))
               (IF (= BLHID "")
                   (WRITE-LINE "HID" FC)
                   (WRITE-LINE BLHID FC)
               )
               (setq BLDIM (GETSTRING T"\nSETTING LAYER OF DIMESION/<DIM1>:"))
               (IF (= BLDIM "")
                   (WRITE-LINE "DIM1" FC)
                   (WRITE-LINE BLDIM FC)
               )
               (setq BLTXT (GETSTRING T"\nSETTING LAYER OF TEXT /<TEXT>:"))
               (IF (= BLTXT "")
                   (WRITE-LINE "TEXT" FC)
                   (WRITE-LINE BLTXT FC)
               )
            (CLOSE FC)
            )
        )
        (SETQ FC (OPEN "C:/ACAD/HON/SET/RING1.SET" "r"))
        (SETQ BLCNT (READ-LINE FC))
        (SETQ BLCEN (READ-LINE FC))
        (SETQ BLHID (READ-LINE FC))
        (SETQ BLDIM (READ-LINE FC))
        (SETQ BLTXT (READ-LINE FC))
        (CLOSE FC)
        (PROMPT "\nCONTINUE OF LAYER IS:" )(PROMPT BLCNT)(TERPRI)
        (PROMPT "\nCENTER OF LAYER IS:" ) (PROMPT BLCEN)(TERPRI)
        (PROMPT "\nHIDDEN OF LAYER IS:" ) (PROMPT BLHID)(TERPRI)
        (PROMPT "\nDIMENSION OF LAYER IS:" ) (PROMPT BLDIM)(TERPRI)
        (PROMPT "\nTEXT   OF LAYER IS:" ) (PROMPT BLTXT)(TERPRI)
     )
 )

 (SETQ ANS (strcase (GETSTRING "\nDO YOU WANT TO CHANGE LAST SETTING <Y/N> N:")))
 (IF (= ANS "Y")
     (PROGN
        (PROMPT "\nPLEASE SETTING LAYER:" )
        (SETQ FC (OPEN "C:/ACAD/HON/SET/RING1.SET" "w"))
        (PROMPT "\nCONTINUE OF LAYER <" )(PROMPT BLCNT)(PROMPT">:")
        (setq BLCNT (GETSTRING T))
        (IF (= BLCNT "")
               (WRITE-LINE "0" FC)
               (WRITE-LINE BLCNT FC)
        )
        (PROMPT "\nCENTER OF LAYER <" )(PROMPT BLCEN)(PROMPT">:")
        (setq BLCEN (GETSTRING T))
        (IF (= BLCEN "")
               (WRITE-LINE "CEN" FC)
               (WRITE-LINE BLCEN FC)
        )
        (PROMPT "\nHIDDEN OF LAYER <" )(PROMPT BLHID)(PROMPT">:")
        (setq BLHID (GETSTRING T))
        (IF (= BLHID "")
               (WRITE-LINE "HID" FC)
               (WRITE-LINE BLHID FC)
        )
        (PROMPT "\nDIMESION OF LAYER <" )(PROMPT BLDIM)(PROMPT">:")
        (setq BLDIM (GETSTRING T))
        (IF (= BLDIM "")
               (WRITE-LINE "DIM1" FC)
               (WRITE-LINE BLDIM FC)
        )
        (PROMPT "\nTEXT OF LAYER <" )(PROMPT BLTXT)(PROMPT">:")
        (setq BLTXT (GETSTRING T))
        (IF (= BLTXT "")
               (WRITE-LINE "TEXT" FC)
               (WRITE-LINE BLTXT FC)
        )
        (CLOSE FC)
        (SETQ FC (OPEN "C:/ACAD/HON/SET/RING1.SET" "r"))
        (SETQ BLCNT (READ-LINE FC))
        (SETQ BLCEN (READ-LINE FC))
        (SETQ BLHID (READ-LINE FC))
        (SETQ BLDIM (READ-LINE FC))
        (SETQ BLTXT (READ-LINE FC))
        (CLOSE FC)
        (PROMPT "\nCONTINUE OF LAYER NOW IS:" )(PROMPT BLCNT)(TERPRI)
        (PROMPT "\nCENTER   OF LAYER NOW IS:" ) (PROMPT BLCEN)(TERPRI)
        (PROMPT "\nHIDDEN   OF LAYER NOW IS:" ) (PROMPT BLHID)(TERPRI)
        (PROMPT "\nDIM      OF LAYER NOW IS:" ) (PROMPT BLDIM)(TERPRI)
        (PROMPT "\nTEXT     OF LAYER NOW  IS:" ) (PROMPT BLTXT)(TERPRI)
   )
 )


  ;THE POINT IS FIST COUNTER Y THEN X
  (MENUCMD "S=X")
  (MENUCMD "S=RING")
; (SETQ D "3/8")
  (SETQ D (GETSTRING"\nSelect dim:"))
  (GRAPHSCR) (TERPRI)                                     ;GRAPHICS MODE
  (SETQ ANS1 "Y")
; (IF  (= (SETQ ANS1 (GETSTRING "\nDOU YOU WANT TO CUT PART LINE (P2) :<Y>")) "")
;      (SETQ ANS1 "Y"))
; (SETQ ANS1 (STRCASE ANS1))
  (IF (= D "3/8")
      (PROGN
         (SETQ A 41)
         (SETQ B 25)
         (SETQ C 8)
         (SETQ D 9.52)
         (SETQ BD 20)
         (SETQ T 7)
         (SETQ SH 21)
         (SETQ BH 41.5)
         (SETQ L 18)
         (SETQ E 4)
         (SETQ G 7)
         (SETQ R 4)
         (SETQ K 1.5)
         (SETQ D1 10)
         (SETQ R1 8.32)  ;SMALL RAD
         (SETQ R2 3.3)  ;SMALL RAD
         (SETQ R3 2)  ;SMALL RAD
         (SETQ R4 20.5)  ;SMALL RAD
         (SETQ R5 4)  ;SMALL RAD
         (SETQ L1 4.17)
         (SETQ L2 1.71)
         (SETQ L3 0.89)
         (SETQ L4 8.14)
         (SETQ AG3 10.5876)
         (SETQ AG4 169.4124)
      )
  )
  (IF (= D "1/2")
      (PROGN
         (SETQ A 50)
         (SETQ B 30)
         (SETQ C 10)
         (SETQ D 12.7)
         (SETQ BD 25)
         (SETQ T 9)
         (SETQ SH 26)
         (SETQ BH 51)
         (SETQ L 22)
         (SETQ E 5)
         (SETQ G 9.5)
         (SETQ R 6)
         (SETQ K 2)
         (SETQ D1 13.2)
         (SETQ R1 11.08)  ;SMALL RAD
         (SETQ R2 4.87)  ;SMALL RAD
         (SETQ R3 2)  ;SMALL RAD
         (SETQ R4 20.5)  ;SMALL RAD
         (SETQ R5 4)  ;SMALL RAD
         (SETQ L1 4.17)
         (SETQ L2 1.71)
         (SETQ L3 0.89)
         (SETQ L4 8.14)
         (SETQ AG3 10.5876)
         (SETQ AG4 169.4124)
      )
  )
  (IF (= D "5/8")
      (PROGN
         (SETQ A 60)
         (SETQ B 35)
         (SETQ C 12.5)
         (SETQ D 15.88)
         (SETQ BD 30)
         (SETQ T 11)
         (SETQ SH 30)
         (SETQ BH 60)
         (SETQ L 27)
         (SETQ E 5)
         (SETQ G 12.5)
         (SETQ R 6)
         (SETQ K 2)
         (SETQ D1 16)
         (SETQ R1 16.76)  ;SMALL RAD
         (SETQ R2 4.71)  ;SMALL RAD
         (SETQ R3 2)  ;SMALL RAD
         (SETQ R4 20.5)  ;SMALL RAD
         (SETQ R5 4)  ;SMALL RAD
         (SETQ L1 4.17)
         (SETQ L2 1.71)
         (SETQ L3 0.89)
         (SETQ L4 8.14)
         (SETQ AG3 10.5876)
         (SETQ AG4 169.4124)
      )
  )
  (IF (= D "3/4")
      (PROGN
         (SETQ A 72)
         (SETQ B 40)
         (SETQ C 16)
         (SETQ D 19.05)
         (SETQ BD 35)
         (SETQ T 13)
         (SETQ SH 35)
         (SETQ BH 71)
         (SETQ L 30)
         (SETQ E 6)
         (SETQ G 15)
         (SETQ R 8)
         (SETQ K 2.5)
         (SETQ D1 20)
         (SETQ R1 19.40)  ;SMALL RAD
         (SETQ R2 5.66)  ;SMALL RAD
         (SETQ R3 2)  ;SMALL RAD
         (SETQ R4 20.5)  ;SMALL RAD
         (SETQ R5 4)  ;SMALL RAD
         (SETQ L1 4.17)
         (SETQ L2 1.71)
         (SETQ L3 0.89)
         (SETQ L4 8.14)
         (SETQ AG3 10.5876)
         (SETQ AG4 169.4124)
      )
  )
  (IF (= D "7/8")
      (PROGN
         (SETQ A 81)
         (SETQ B 45)
         (SETQ C 18)
         (SETQ D 22.22)
         (SETQ BD 40)
         (SETQ T 15)
         (SETQ SH 40)
         (SETQ BH 80.5)
         (SETQ L 35)
         (SETQ E 7)
         (SETQ G 18)
         (SETQ R 10)
         (SETQ K 3)
         (SETQ D1 22.4)
         (SETQ R1 22.07)  ;SMALL RAD
         (SETQ R2 7.08)  ;SMALL RAD
         (SETQ R3 2)  ;SMALL RAD
         (SETQ R4 20.5)  ;SMALL RAD
         (SETQ R5 4)  ;SMALL RAD
         (SETQ L1 4.17)
         (SETQ L2 1.71)
         (SETQ L3 0.89)
         (SETQ L4 8.14)
         (SETQ AG3 10.5876)
         (SETQ AG4 169.4124)
      )
  )
  (IF (= D "1")
      (PROGN
         (SETQ A 90)
         (SETQ B 50)
         (SETQ C 20)
         (SETQ D 25.4)
         (SETQ BD 45)
         (SETQ T 18)
         (SETQ SH 45)
         (SETQ BH 90)
         (SETQ L 38)
         (SETQ E 8)
         (SETQ G 20.5)
         (SETQ R 12)
         (SETQ K 3)
         (SETQ D1 26.5)
         (SETQ R1 28.38)  ;SMALL RAD
         (SETQ R2 8.01)  ;SMALL RAD
         (SETQ R3 2)  ;SMALL RAD
         (SETQ R4 20.5)  ;SMALL RAD
         (SETQ R5 4)  ;SMALL RAD
         (SETQ L1 4.17)
         (SETQ L2 1.71)
         (SETQ L3 0.89)
         (SETQ L4 8.14)
         (SETQ AG3 10.5876)
         (SETQ AG4 169.4124)
      )
  )
  (IF (= D "114")
      (PROGN
         (SETQ A 110)
         (SETQ B 60)
         (SETQ C 25)
         (SETQ D 31.75)
         (SETQ BD 60)
         (SETQ T 22)
         (SETQ SH 55)
         (SETQ BH 110)
         (SETQ L 45)
         (SETQ E 8)
         (SETQ G 26)
         (SETQ R 15)
         (SETQ K 3.5)
         (SETQ D1 33.5)
         (SETQ R1 37.75)  ;SMALL RAD
         (SETQ R2 7.28)  ;SMALL RAD
         (SETQ R3 2)  ;SMALL RAD
         (SETQ R4 20.5)  ;SMALL RAD
         (SETQ R5 4)  ;SMALL RAD
         (SETQ L1 4.17)
         (SETQ L2 1.71)
         (SETQ L3 0.89)
         (SETQ L4 8.14)
         (SETQ AG3 10.5876)
         (SETQ AG4 169.4124)
      )
  )
  (IF (= D "112")
      (PROGN
         (SETQ A 133)
         (SETQ B 70)
         (SETQ C 25)
         (SETQ D 38.10)
         (SETQ BD 70)
         (SETQ T 26)
         (SETQ SH 65)
         (SETQ BH 131.5)
         (SETQ L 55)
         (SETQ E 10)
         (SETQ G 32)
         (SETQ R 18)
         (SETQ K 4)
         (SETQ D1 40)
         (SETQ R1 47.36)  ;SMALL RAD
         (SETQ R2 10.04)  ;SMALL RAD
         (SETQ R3 2)  ;SMALL RAD
         (SETQ R4 20.5)  ;SMALL RAD
         (SETQ R5 4)  ;SMALL RAD
         (SETQ L1 4.17)
         (SETQ L2 1.71)
         (SETQ L3 0.89)
         (SETQ L4 8.14)
         (SETQ AG3 10.5876)
         (SETQ AG4 169.4124)
      )
  )
  (IF (= D "134")
      (PROGN
         (SETQ A 151)
         (SETQ B 80)
         (SETQ C 35.5)
         (SETQ D 44.45)
         (SETQ BD 80)
         (SETQ T 30)
         (SETQ SH 75)
         (SETQ BH 150.5)
         (SETQ L 65)
         (SETQ E 12)
         (SETQ G 37)
         (SETQ R 20)
         (SETQ K 4.5)
         (SETQ D1 45)
         (SETQ R1 57.13)  ;SMALL RAD
         (SETQ R2 11.91)  ;SMALL RAD
         (SETQ R3 2)  ;SMALL RAD
         (SETQ R4 20.5)  ;SMALL RAD
         (SETQ R5 4)  ;SMALL RAD
         (SETQ L1 4.17)
         (SETQ L2 1.71)
         (SETQ L3 0.89)
         (SETQ L4 8.14)
         (SETQ AG3 10.5876)
         (SETQ AG4 169.4124)
      )
  )
  (IF (= D "2")
      (PROGN
         (SETQ A 171)
         (SETQ B 90)
         (SETQ C 40)
         (SETQ D 50.80)
         (SETQ BD 90)
         (SETQ T 35)
         (SETQ SH 85)
         (SETQ BH 170)
         (SETQ L 70)
         (SETQ E 12)
         (SETQ G 42)
         (SETQ R 22)
         (SETQ K 5)
         (SETQ D1 53)
         (SETQ R1 67.02)  ;SMALL RAD
         (SETQ R2 10.08)  ;SMALL RAD
         (SETQ R3 2)  ;SMALL RAD
         (SETQ R4 20.5)  ;SMALL RAD
         (SETQ R5 4)  ;SMALL RAD
         (SETQ L1 4.17)
         (SETQ L2 1.71)
         (SETQ L3 0.89)
         (SETQ L4 8.14)
         (SETQ AG3 10.5876)
         (SETQ AG4 169.4124)
      )
  )
; (SETQ P1 (LIST 563.587 428.28))
; (SETQ P2 (LIST 563.587 528.28))
  (SETQ P1 (GETPOINT "\nP1:"))
  (SETQ P2 (GETPOINT P1 "\nP2:"))
  (SETQ LSE (DISTANCE P1 P2))
  (SETQ AG1 (ANGLE P1 P2))
  (SETQ AG2 (* PI 0.5))
  (SETQ LSE (DISTANCE P1 P2)) ;DIST FOR P1 P2
  (SETQ DR1 (POLAR (POLAR P1 AG1 K) (+ AG1 AG2) (/ D 2.0)))
  (SETQ DR2 (POLAR (POLAR P1 AG1 K) (- AG1 AG2) (/ D 2.0)))
  (SETQ DR3 (POLAR (POLAR P1 AG1 (- L E)) (+ AG1 AG2) (/ D 2.0)))
  (SETQ DR4 (POLAR (POLAR P1 AG1 (- L E)) (- AG1 AG2) (/ D 2.0)))
  (SETQ DR5 (POLAR (POLAR P1 AG1 K) (+ AG1 AG2) (/ G 2.0)))
  (SETQ DR6 (POLAR (POLAR P1 AG1 K) (- AG1 AG2) (/ G 2.0)))
  (SETQ DR7 (POLAR (POLAR P1 AG1 (- L E)) (+ AG1 AG2) (/ G 2.0)))
  (SETQ DR8 (POLAR (POLAR P1 AG1 (- L E)) (- AG1 AG2) (/ G 2.0)))
  (SETQ DR9 (POLAR (POLAR P1 AG1 L) (+ AG1 AG2) (/ G 2.0)))
  (SETQ DR10 (POLAR (POLAR P1 AG1 L) (- AG1 AG2) (/ G 2.0)))
  (SETQ DR11 (POLAR (POLAR P1 AG1 L) (+ AG1 AG2) (/ BD 2.0)))
  (SETQ DR12 (POLAR (POLAR P1 AG1 L) (- AG1 AG2) (/ BD 2.0)))
  (SETQ DR13 (POLAR (POLAR P1 AG1 (- (+ L T ) R3)) (+ AG1 AG2) (/ BD 2.0)))
  (SETQ DR14 (POLAR (POLAR P1 AG1 (- (+ L T ) R3)) (- AG1 AG2) (/ BD 2.0)))
  (SETQ DR15 (POLAR (POLAR P1 AG1 (+ L T )) (+ AG1 AG2) (- (/ BD 2.0) R3)))
  (SETQ DR16 (POLAR (POLAR P1 AG1 (+ L T )) (- AG1 AG2) (- (/ BD 2.0) R3)))
  (SETQ DR17 (POLAR P1 AG1 (+ L SH)))
  (SETQ DR17-1 (POLAR P1 AG1 (- (+ L SH) (* B 0.5))))
  (SETQ DR19 (POLAR (POLAR P1 AG1 (+ L L1)) (+ AG1 AG2) (+ (/ BD 2.0) L2)))
  (SETQ DR20 (POLAR (POLAR P1 AG1 (+ L L1)) (- AG1 AG2) (+ (/ BD 2.0) L2)))
  (SETQ DR21 (POLAR P1 AG1 (+ L BH)))
  (SETQ DR23 (POLAR (POLAR P1 AG1 (+ L L3)) (+ AG1 AG2) (/ BD 2.0)))
  (SETQ DR24 (POLAR (POLAR P1 AG1 (+ L L3)) (- AG1 AG2) (/ BD 2.0)))
  (SETQ DR25 (POLAR (POLAR P1 AG1 (+ L SH)) (+ AG1 AG2) (+ (/ A 2.0) 1)))
  (SETQ DR26 (POLAR (POLAR P1 AG1 (+ L SH)) (- AG1 AG2) (+ (/ A 2.0) 1)))
  (IF (= ANS1 "Y")
      (COMMAND "LAYER" "SET" BLCNT "")
      (COMMAND "LAYER" "SET" BLHID "")
  )
  (COMMAND "LINE" DR1 DR3 "")
  (COMMAND "LINE" DR2 DR4 "")
  (COMMAND "LINE" DR1 DR2 "")
  (COMMAND "LINE" DR3 DR4 "")
  (COMMAND "ARC" DR1 "E" DR2 "R" R1)
  (COMMAND "LINE" DR5 DR7 "")
  (COMMAND "LINE" DR6 DR8 "")
  (COMMAND "ARC" DR7 "E" DR9 "R" R2)
  (COMMAND "ARC" DR10 "E" DR8 "R" R2)
  (COMMAND "LINE" DR11 DR12 "")
  (COMMAND "LINE" DR11 DR13 "")
  (COMMAND "LINE" DR12 DR14 "")
  (COMMAND "LINE" DR15 DR16 "")
  (COMMAND "ARC" DR15 "E" DR13 "R" R3)
  (COMMAND "ARC" DR14 "E" DR16 "R" R3)
  (COMMAND "LINE" DR15 DR17-1 "")
  (COMMAND "LINE" DR16 DR17-1 "")
  (COMMAND "CIRCLE" DR17 "D" B)
  (COMMAND "ARC" DR19 DR21 DR20)
  (COMMAND "ARC" DR23 "E" DR19 "R" R)
  (COMMAND "ARC" DR20 "E" DR24 "R" R)
  (COMMAND "LAYER" "SET" BLCEN "")
  (COMMAND "LINE" (POLAR P1 AG1 (- 0 1)) (POLAR P1 AG1 (+ 1 BH L)) "")
  (COMMAND "LINE" DR25 DR26 "")
  (COMMAND "LAYER" "SET" NY "")
)
