DEFUN C:WT2
;SET LAYER
(COMMAND "SETVAR" "CMDECHO" 0)
(setq WT2SET (findfile "C:/ACAD/HON/SET/WT2.SET"))
(IF (= WT2SET NIL)
    (PROGN
       (SETQ FC (OPEN "C:/ACAD/HON/SET/WT2.SET" "w"))
       (setq WT2CNT (GETSTRING T"\nSETTING COOLING  LAYER OF CONTNIUE LINE/<DRAW>:"))
       (IF (= WT2CNT "")
              (WRITE-LINE "DRAW" FC)
              (WRITE-LINE WT2CNT FC)
       )
       (setq WT2CEN (GETSTRING T"\nSETTING COOLING LAYER OF CENTER LINE/<CENTER>:"))
       (IF (= WT2CEN "")
              (WRITE-LINE "CENTER" FC)
              (WRITE-LINE WT2CEN FC)
       )
       (setq WT2HID (GETSTRING T"\nSETTING COOLING  LAYER OF HIDDEN LINE/<HIDDEN>:"))
       (IF (= WT2HID "")
              (WRITE-LINE "HIDDEN" FC)
              (WRITE-LINE WT2HID FC)
       )
       (CLOSE FC)
    )
)

(IF (/= WT2SET NIL)
    (PROGN
       (SETQ FC (OPEN "C:/ACAD/HON/SET/WT2.SET" "r"))
       (SETQ WT2CNT (READ-LINE FC))
       (SETQ WT2CEN (READ-LINE FC))
       (SETQ WT2HID (READ-LINE FC))
       (CLOSE FC)
       (PROMPT "\nCOOLING CONTINUE OF LAYER IS:" )(PROMPT WT2CNT)(TERPRI)
       (PROMPT "\nCOOLING CENTER OF LAYER IS:" ) (PROMPT WT2CEN)(TERPRI)
       (PROMPT "\nCOOLING HIDDEN OF LAYER IS:" ) (PROMPT WT2HID)(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/WT2.SET" "w"))
       (PROMPT "\nCOOLING CONTINUE OF LAYER IS:" )(PROMPT WT2CNT)(TERPRI)
       (setq WT2CNT (GETSTRING T"\nSETTING COOLING LAYER OF CONTNIUE LINE:"))
       (IF (= WT2CNT "")
              (WRITE-LINE "DRAW" FC)
              (WRITE-LINE WT2CNT FC)
       )
       (PROMPT "\nCOOLING CONTINUE OF LAYER IS:" )(PROMPT WT2CEN)(TERPRI)
       (setq WT2CEN (GETSTRING T"\nSETTING COOLING PIN LAYER OF CENTER LINE:"))
       (IF (= WT2CEN "")
              (WRITE-LINE "CENTER" FC)
              (WRITE-LINE WT2CEN FC)
       )
       (PROMPT "\nCOOLING CONTINUE OF LAYER IS:" )(PROMPT WT2HID)(TERPRI)
       (setq WT2HID (GETSTRING T"\nSETTING COOLING PIN LAYER OF HIDDEN LINE:"))
       (IF (= WT2HID "")
              (WRITE-LINE "HIDDEN" FC)
              (WRITE-LINE WT2HID FC)
       )
       (CLOSE FC)
       (SETQ FC (OPEN "C:/ACAD/HON/SET/WT2.SET" "r"))
       (SETQ WT2CNT (READ-LINE FC))
       (SETQ WT2CEN (READ-LINE FC))
       (SETQ WT2HID (READ-LINE FC))
       (CLOSE FC)
       (PROMPT "\nCOOLING CONTINUE OF LAYER NOW IS:" )(PROMPT WT2CNT)(TERPRI)
       (PROMPT "\nCOOLING CENTER   OF LAYER NOW IS:" ) (PROMPT WT2CEN)(TERPRI)
       (PROMPT "\nCOOLING HIDDEN   OF LAYER NOW IS:" ) (PROMPT WT2HID)(TERPRI)
  )
)


;THE POINT IS FIST COUNTER Y THEN X
(COMMAND "LAYER" "SET" WT2CNT "")
(MENUCMD "S=WAT")
;(COMMAND "UJ" "")
(GRAPHSCR) (TERPRI)                                     ;GRAPHICS MODE
(SETQ WD (GETREAL"\nSelect dim:"))
(IF  (= (SETQ ANS (GETSTRING "\nDOU YOU WANT TO TRIM P2 LINE:<Y>")) "")
     (SETQ ANS "Y"))
(SETQ ANS (STRCASE ANS))
(IF (= WD 15)
    (PROGN
       (SETQ SC 0.85)
       (SETQ L1 26)
       (SETQ L2 19.60)
       (SETQ L3 1.70)
     )
)
(IF (= WD 20)
    (PROGN
       (SETQ SC 1.25)
       (SETQ L1 24.6)
       (SETQ L2 34.0)
       (SETQ L3 2.50)
    )
)
(IF (= WD 25)
    (PROGN
       (SETQ SC 1.25)
       (SETQ L1 38)
       (SETQ L2 28)
       (SETQ L3 2.50)
     )
)
(IF (= WD 30)
    (PROGN
       (SETQ SC 1.25)
       (SETQ L1 44)
       (SETQ L2 34.6)
       (SETQ L3 2.50)
     )
)
(IF (= WD 35)
    (PROGN
       (SETQ SC 1.25)
       (SETQ L1 48)
       (SETQ L2 38.6)
       (SETQ L3 2.50)
     )
)
(IF (= WD 40)
    (PROGN
       (SETQ SC 1.25)
       (SETQ L1 54)
       (SETQ L2 44)
       (SETQ L3 1.70)
     )
)
(IF (= WD 45)
    (PROGN
       (SETQ SC 2.15)
       (SETQ L1 65)
       (SETQ L2 50)
       (SETQ L3 4.30)
     )
)
(SETQ P1 (GETPOINT "\nP1:"))
(SETQ P2 (GETPOINT P1 "\nP2:"))
(SETQ P3 (GETPOINT P2 "\nP3:"))
(SETQ ag1 (ANGLE P1 P2))
(SETQ AG2 (* PI 0.5))
(SETQ AG3 (/ PI 3))
(SETQ LSE (DISTANCE P1 P3)) ;DIST FOR P1 P3
(SETQ LST (DISTANCE P1 P2)) ;DIST FOR P1 P2
(SETQ DR1 (POLAR (POLAR P1 AG1 LST ) (- AG1 AG2) (/ WD 2.0)))
(SETQ DR2 (POLAR (POLAR P1 AG1 LST ) (+ AG1 AG2) (/ WD 2.0)))
(SETQ DR3 (POLAR (POLAR P1 (* AG1 -1) LSE ) (- AG1 AG2) (/ WD 2.0)))
(SETQ DR4 (POLAR (POLAR P1 (* AG1 -1) LSE ) (+ AG1 AG2) (/ WD 2.0)))
(SETQ DR5 (POLAR (POLAR P1 (* AG1 -1) LSE ) (- AG1 AG3) (/ WD 2.0)))
(SETQ DR6 (POLAR (POLAR P1 (* AG1 -1) LSE ) (+ AG1 AG3) (/ WD 2.0)))
(SETQ INT1 (INTERS P3 DR5 DR1 DR3 NIL))
(SETQ INT2 (INTERS P3 DR6 DR2 DR4 NIL))
(SETQ DR7 (POLAR P1 (- AG1 AG2) (/ L2 2.0)))
(SETQ DR8 (POLAR P1 (+ AG1 AG2) (/ L2 2.0)))
(SETQ DR9  (POLAR (POLAR P1 AG1 (* L3 -1)) (- AG1 AG2) (/ L2 2.0)))
(SETQ DR10 (POLAR (POLAR P1 AG1 (* L3 -1)) (+ AG1 AG2) (/ L2 2.0)))
(SETQ DR11 (POLAR P1 (- AG1 AG2) (/ L1 2.0)))
(SETQ DR12 (POLAR P1 (+ AG1 AG2) (/ L1 2.0)))
(SETQ DR13 (POLAR (POLAR P1 AG1 (* L3 -1)) (- AG1 AG2) (/ L1 2.0)))
(SETQ DR14 (POLAR (POLAR P1 AG1 (* L3 -1)) (+ AG1 AG2) (/ L1 2.0)))
(SETQ DR15 (POLAR (POLAR P1 (* AG1 -1) (/ L3 2)) (- AG1 AG2) (- (/ L1 2.0) SC)))
(SETQ DR16 (POLAR (POLAR P1 (* AG1 -1) (/ L3 2)) (+ AG1 AG2) (- (/ L1 2.0) SC)))
;CIRCLE OF CENTER

(COMMAND "LAYER" "SET" WT2CNT "")
(COMMAND "LINE" DR1 DR2 "")
(COMMAND "LINE" DR1 INT1 "")
(COMMAND "LINE" DR2 INT2 "")
(COMMAND "LINE" INT1 INT2 "")
(COMMAND "LINE" P3  INT1 "")
(COMMAND "LINE" P3  INT2 "")
(COMMAND "LAYER" "SET" WT2HID "")
(COMMAND "LINE" DR7 DR8 "")
(COMMAND "LAYER" "SET" WT2CNT "")
(COMMAND "LINE" DR7 DR9 "")
(COMMAND "LINE" DR8 DR10 "")
(COMMAND "LINE" DR7 DR11 "")
(COMMAND "LINE" DR8 DR12 "")
(COMMAND "LINE" DR11 DR13 "")
(COMMAND "LINE" DR12 DR14 "")
(COMMAND "CIRCLE" DR15 SC )
(COMMAND "CIRCLE" DR16 SC )
;(IF (= ANS "Y")
;    (COMMAND "TRIM" DR15 DR16 "" (POLAR P2 (+ AG1 AG2) 1) "")
;)
(COMMAND "LAYER" "SET" WT2CEN "")
(COMMAND "LINE" (POLAR P2 AG1 1) (POLAR P3 AG1 -1) "")
