(defun c:RUN1()
; (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/RUN1.SET"))
 (IF (= BLSET NIL)
     (PROGN
        (SETQ TEST 1)
        (PROMPT "\nPLEASE SETTING LAYER:" )
        (SETQ FC (OPEN "C:/ACAD/HON/SET/RUN1.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/RUN1.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/RUN1.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/RUN1.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/RUN1.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/RUN1.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=RUN1")
; (SETQ D "3/8")
  (COMMAND "TEXT" VIEWCTR 5 0 "\n¿ï¾Üª½®|")
  (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 "4")
      (PROGN
         (SETQ R 2)
         (SETQ H 4)
      )
  )
  (IF (= D "6")
      (PROGN
         (SETQ R 3)
         (SETQ H 3.5)
      )
  )
  (IF (= D "7")
      (PROGN
         (SETQ R 3.5)
         (SETQ H 7)
      )
  )
  (IF (= D "8")
      (PROGN
         (SETQ R 4)
         (SETQ H 8)
      )
  )
  (IF (= D "9")
      (PROGN
         (SETQ R 4.5)
         (SETQ H 9)
      )
  )
  (IF (= D "10")
      (PROGN
         (SETQ R 5)
         (SETQ H 10)
      )
  )
  (IF (= D "12")
      (PROGN
         (SETQ R 6)
         (SETQ H 12)
      )
  )
; (SETQ P1 (LIST 563.587 428.28))
; (SETQ P2 (LIST 563.587 528.28))
  (SETQ P1 (GETPOINT "\nP1:"))
  (SETQ P2 (GETPOINT P1 "\nDIRECTION:"))
  (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 P1 AG1 R ))
  (SETQ DR3 (POLAR (POLAR P1 AG1 R ) (+ AG1 AG2) R))
  (SETQ DR4 (POLAR (POLAR P1 AG1 R ) (- AG1 AG2) R))
  (SETQ DR5 (POLAR P1 AG1 (* R 2.0)))
  (SETQ DR7 (POLAR P1 (+ AG1 AG2) R ))
  (SETQ DR8 (POLAR P1 (- AG1 AG2) R ))

  (SETQ DR9 (POLAR DR3 (- AG1 AG2 (DTR 100)) R))
  (SETQ DR10 (POLAR DR4 (- AG1 AG2 (DTR 80)) R))

  (SETQ INT1 (INTERS DR3 DR9 P1 DR7 NIL))
  (SETQ INT2 (INTERS DR4 DR10 P1 DR8 NIL))
  (IF (= ANS1 "Y")
      (COMMAND "LAYER" "SET" BLCNT "")
      (COMMAND "LAYER" "SET" BLHID "")
  )
  (COMMAND "LAYER" "SET" BLHID "")
  (COMMAND "ARC" DR4 P1 DR3)
  (COMMAND "LAYER" "SET" BLCNT "")
  (COMMAND "ARC" DR4 DR5 DR3)
  (COMMAND "LINE" DR3 INT1 "")
  (COMMAND "LINE" DR4 INT2 "")
  (COMMAND "LAYER" "SET" BLCEN "")
  (COMMAND "LINE" (POLAR P1 AG1 (- 0 1)) (POLAR P1 AG1 (+ 1 H)) "")
  (COMMAND "LAYER" "SET" NY "")
)
