DEFUN C:WT1
;SET LAYER
;(IF (= (TYPE F1) 'FILE ) "YES"  (STOP))
;(IF (= (TYPE F2) 'FILE ) "YES" (STOP))
(COMMAND "SETVAR" "CMDECHO" 0)
(SETQ NY (GETVAR "CLAYER"))
(setq WT1SET (findfile "C:/ACAD/HON/SET/WT1.SET"))
(IF (= WT1SET NIL)
    (PROGN
       (SETQ FC (OPEN "C:/ACAD/HON/SET/WT1.SET" "w"))
       (setq WT1CNT (GETSTRING T"\nSETTING COOLING  LAYER OF CONTNIUE LINE/<DRAW>:"))
       (IF (= WT1CNT "")
              (WRITE-LINE "DRAW" FC)
              (WRITE-LINE WT1CNT FC)
       )
       (setq WT1CEN (GETSTRING T"\nSETTING COOLING LAYER OF CENTER LINE/<CENTER>:"))
       (IF (= WT1CEN "")
              (WRITE-LINE "CENTER" FC)
              (WRITE-LINE WT1CEN FC)
       )
       (setq WT1HID (GETSTRING T"\nSETTING COOLING  LAYER OF HIDDEN LINE/<HIDDEN>:"))
       (IF (= WT1HID "")
              (WRITE-LINE "HIDDEN" FC)
              (WRITE-LINE WT1HID FC)
       )
       (CLOSE FC)
    )
)

(IF (/= WT1SET NIL)
    (PROGN
       (SETQ FC (OPEN "C:/ACAD/HON/SET/WT1.SET" "r"))
       (SETQ WT1CNT (READ-LINE FC))
       (SETQ WT1CEN (READ-LINE FC))
       (SETQ WT1HID (READ-LINE FC))
       (IF (OR (= WT1CNT "") (= WT1CEN "") (= WT1HID "")
               (= WT1CNT NIL) (= WT1CEN NIL) (= WT1HID NIL))
           (CLOSE FC)
       )
       (IF (OR (= WT1CNT "") (= WT1CEN "") (= WT1HID "")
               (= WT1CNT NIL) (= WT1CEN NIL) (= WT1HID NIL))
           (PROGN
              (PROMPT "\nPLEASE SETTING LAYER OF COOLING :" )
              (SETQ FC (OPEN "C:/ACAD/HON/SET/WT1.SET" "w"))
              (setq WT1CNT (GETSTRING T"\nSETTING COOLING  LAYER OF CONTNIUE LINE/<DRAW>:"))
             (IF (= WT1CNT "")
                    (WRITE-LINE "DRAW" FC)
                    (WRITE-LINE WT1CNT FC)
             )
             (setq WT1CEN (GETSTRING T"\nSETTING COOLING LAYER OF CENTER LINE/<CENTER>:"))
            (IF (= WT1CEN "")
                 (WRITE-LINE "CENTER" FC)
                 (WRITE-LINE WT1CEN FC)
             )
             (setq WT1HID (GETSTRING T"\nSETTING COOLING  LAYER OF HIDDEN LINE/<HIDDEN>:"))
             (IF (= WT1HID "")
                 (WRITE-LINE "HIDDEN" FC)
                 (WRITE-LINE WT1HID FC)
             )
       (CLOSE FC)
       )
    )
       (SETQ FC (OPEN "C:/ACAD/HON/SET/WT1.SET" "r"))
       (SETQ WT1CNT (READ-LINE FC))
       (SETQ WT1CEN (READ-LINE FC))
       (SETQ WT1HID (READ-LINE FC))
       (CLOSE FC)
       (PROMPT "\nCOOLING CONTINUE OF LAYER IS:" )(PROMPT WT1CNT)(TERPRI)
       (PROMPT "\nCOOLING CENTER OF LAYER IS:" ) (PROMPT WT1CEN)(TERPRI)
       (PROMPT "\nCOOLING HIDDEN OF LAYER IS:" ) (PROMPT WT1HID)(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/WT1.SET" "w"))
       (PROMPT "\nCOOLING CONTINUE OF LAYER <" )(PROMPT WT1CNT)(PROMPT">:")
       (setq WT1CNT (GETSTRING T))
       (IF (= WT1CNT "")
              (WRITE-LINE "DRAW" FC)
              (WRITE-LINE WT1CNT FC)
       )
       (PROMPT "\nCOOLING CONTINUE OF LAYER <" )(PROMPT WT1CEN)(PROMPT">:")
       (setq WT1CEN (GETSTRING T))
       (IF (= WT1CEN "")
              (WRITE-LINE "CENTER" FC)
              (WRITE-LINE WT1CEN FC)
       )
       (PROMPT "\nCOOLING CONTINUE OF LAYER <" )(PROMPT WT1HID)(PROMPT">:")
       (setq WT1HID (GETSTRING T))
       (IF (= WT1HID "")
              (WRITE-LINE "HIDDEN" FC)
              (WRITE-LINE WT1HID FC)
       )
       (CLOSE FC)
       (SETQ FC (OPEN "C:/ACAD/HON/SET/WT1.SET" "r"))
       (SETQ WT1CNT (READ-LINE FC))
       (SETQ WT1CEN (READ-LINE FC))
       (SETQ WT1HID (READ-LINE FC))
       (CLOSE FC)
       (PROMPT "\nCOOLING CONTINUE OF LAYER NOW IS:" )(PROMPT WT1CNT)(TERPRI)
       (PROMPT "\nCOOLING CENTER   OF LAYER NOW IS:" ) (PROMPT WT1CEN)(TERPRI)
       (PROMPT "\nCOOLING HIDDEN   OF LAYER NOW IS:" ) (PROMPT WT1HID)(TERPRI)
  )
)


;THE POINT IS FIST COUNTER Y THEN X
(COMMAND "LAYER" "SET" WT1CNT "")
(MENUCMD "S=WAT")
;(COMMAND "UJ" "")
(GRAPHSCR) (TERPRI)                                     ;GRAPHICS MODE
(SETQ WD (GETSTRING"\nSelect dim:"))
;(IF  (= (SETQ ANS (GETSTRING "\nDOU YOU WANT TO TRIM P2 LINE:<Y>")) "")
;     (SETQ ANS "Y"))
;(SETQ ANS (STRCASE ANS))
(IF (= WD "1/8")
    (PROGN
       (SETQ D 9.728)
       (SETQ ID 8.556)
       (SETQ D1 8)
       (SETQ L  10)
       (SETQ K  1)
     )
)
(IF (= WD "1/4")
    (PROGN
       (SETQ D 13.157)
       (SETQ ID 11.445)
       (SETQ D1 10)
       (SETQ L  12)
       (SETQ K  1)
     )
)
(IF (= WD "3/8")
    (PROGN
       (SETQ D 16.662)
       (SETQ ID 14.950)
       (SETQ D1 12)
       (SETQ L  14)
       (SETQ K  1)
     )
)
(IF (= WD "1/2")
    (PROGN
       (SETQ D 20.955)
       (SETQ ID 18.631)
       (SETQ D1 16)
       (SETQ L  19)
       (SETQ K  1.5)
     )
)
(SETQ P1 (GETPOINT "\nP1:"))
(SETQ P2 (GETPOINT P1 "\nP2:"))
(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 AG2) (/ D 2.0)) AG1 (+ L K )))
(SETQ DR4 (POLAR (POLAR P1 (+ AG1 AG2) (/ D 2.0)) AG1 (+ L K )))

(SETQ DR5 (POLAR (POLAR P1 AG1 0) (- AG1 AG2) (+ (/ ID 2.0) 1)))
(SETQ DR6 (POLAR (POLAR P1 AG1 0) (+ AG1 AG2) (+ (/ ID 2.0) 1)))


(SETQ DR7 (POLAR (POLAR P1 AG1 K ) (- AG1 AG2) (/ ID 2.0)))
(SETQ DR8 (POLAR (POLAR P1 AG1 K ) (+ AG1 AG2) (/ ID 2.0)))
(SETQ DR9 (POLAR (POLAR P1 (- AG1 AG2) (/ ID 2.0)) AG1 (+ L 6)))
(SETQ DR10 (POLAR (POLAR P1 (+ AG1 AG2) (/ ID 2.0)) AG1 (+ L 6)))
(SETQ INT1 (INTERS DR1 DR3 DR5 DR7 NIL))
(SETQ INT2 (INTERS DR2 DR4 DR6 DR8 NIL))

(SETQ DR11 (POLAR (POLAR P1 (- AG1 AG2) (/ ID 2.0)) AG1 (+ L K 0.58)))
(SETQ DR12 (POLAR (POLAR P1 (+ AG1 AG2) (/ ID 2.0)) AG1 (+ L K 0.58)))
(SETQ DR13 (POLAR (POLAR P1 (- AG1 AG2) (/ D1 2.0)) AG1 (+ L 6 0.28)))
(SETQ DR14 (POLAR (POLAR P1 (+ AG1 AG2) (/ D1 2.0)) AG1 (+ L 6 0.28)))
(SETQ DR15 (POLAR (POLAR P1 (- AG1 AG2) (/ D1 2.0)) AG1 LSE))
(SETQ DR16 (POLAR (POLAR P1 (+ AG1 AG2) (/ D1 2.0)) AG1 LSE))


(COMMAND "LINE" INT1 DR3 "")
(COMMAND "LINE" INT2 DR4 "")
(COMMAND "LINE" DR3 DR4 "")
(COMMAND "LINE" DR5 DR7 "")
(COMMAND "LINE" DR6 DR8 "")
(COMMAND "LINE" DR7 DR9 "")
(COMMAND "LINE" DR8 DR10 "")
(COMMAND "LINE" DR7 DR8 "")
(COMMAND "LINE" DR3 DR11 "")
(COMMAND "LINE" DR4 DR12 "")
(COMMAND "LINE" DR9 DR10 "")
(COMMAND "LINE" DR9 DR13 "")
(COMMAND "LINE" DR10 DR14 "")
(COMMAND "LINE" DR13 DR14 "")
(COMMAND "LINE" DR13 DR15 "")
(COMMAND "LINE" DR14 DR16 "")


;BOX ABOVE

;(IF (= ANS "Y")
;    (COMMAND "TRIM" DR15 DR16 "" (POLAR P2 (+ AG1 AG2) 1) "")
;)
(COMMAND "LAYER" "SET" WT1CEN "")
(COMMAND "LINE" (POLAR P1 AG1 -1) (POLAR P1 AG1 (+ 1 LSE)) "")
(COMMAND "LAYER" "SET" NY "")
