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

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


;THE POINT IS FIST COUNTER Y THEN X
(COMMAND "LAYER" "SET" WT3CNT "")
(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 6)
    (PROGN
       (SETQ LC 3)
       (SETQ SC 0.85)
       (SETQ L1 16)
       (SETQ L2 9.60)
       (SETQ L3 1.70)
     )
)
(IF (= WD 8)
    (PROGN
       (SETQ LC 4)
       (SETQ SC 0.85)
       (SETQ L1 18)
       (SETQ L2 11.60)
       (SETQ L3 1.70)
    )
)
(IF (= WD 12)
    (PROGN
       (SETQ LC 6)
       (SETQ SC 0.85)
       (SETQ L1 22)
       (SETQ L2 15.6)
       (SETQ L3 1.70)
     )
)
(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 (+ LSE L3)) (- AG1 AG2) (/ L1 2.0)))
(SETQ DR2 (POLAR (POLAR P1 AG1 (+ LSE L3)) (+ AG1 AG2) (/ L1 2.0)))
(SETQ DR3 (POLAR (POLAR P1 AG1 LSE ) (- AG1 AG2) (/ L1 2.0)))
(SETQ DR4 (POLAR (POLAR P1 AG1 LSE ) (+ AG1 AG2) (/ L1 2.0)))
(SETQ DR5 (POLAR (POLAR P1 AG1 (+ LSE L3)) (- AG1 AG2) (/ L2 2.0)))
(SETQ DR6 (POLAR (POLAR P1 AG1 (+ LSE L3)) (+ AG1 AG2) (/ L2 2.0)))
(SETQ DR7 (POLAR (POLAR P1 AG1 LSE ) (- AG1 AG2) (/ L2 2.0)))
(SETQ DR8 (POLAR (POLAR P1 AG1 LSE ) (+ AG1 AG2) (/ L2 2.0)))
;CIRCLE OF CENTER
(SETQ DR9 (POLAR (POLAR P1 AG1  (+ LSE SC)) (- AG1 AG2)  (- (/ L1 2.0) SC)))
(SETQ DR10 (POLAR (POLAR P1 AG1 (+ LSE SC)) (+ AG1 AG2) (- (/ L1 2.0) SC)))

(SETQ DR11 (POLAR (POLAR P1 AG1 0) (- AG1 AG2) LC ))
(SETQ DR12 (POLAR (POLAR P1 AG1 0) (+ AG1 AG2) LC ))
(SETQ DR13 (POLAR (POLAR P1 AG1 LSE) (- AG1 AG2) LC))
(SETQ DR14 (POLAR (POLAR P1 AG1 LSE) (+ AG1 AG2) LC))

;TRIM POINT
(SETQ DR15 (POLAR (POLAR P1 AG1 LSE) (- AG1 AG2) LC))
(SETQ DR16 (POLAR (POLAR P1 AG1 LSE) (+ AG1 AG2) LC))
;
;CENTER POINT
(SETQ DR17 (POLAR (POLAR P1 AG1 0) (- AG1 AG2) (+ LC 1)))
(SETQ DR18 (POLAR (POLAR P1 AG1 0) (+ AG1 AG2) (+ LC 1)))



(COMMAND "LAYER" "SET" WT3CNT "")
(COMMAND "CIRCLE" P1 LC )
(COMMAND "LINE" DR1 DR5 "")
(COMMAND "LINE" DR2 DR6 "")
(COMMAND "LAYER" "SET" WT3HID "")
(COMMAND "LINE" DR5 DR6 "")
(COMMAND "LAYER" "SET" WT3CNT "")
(COMMAND "LINE" DR1 DR3 "")
(COMMAND "LINE" DR2 DR4 "")
(COMMAND "LINE" DR5 DR7 "")
(COMMAND "LINE" DR6 DR8 "")
(COMMAND "CIRCLE" DR9 SC )
(COMMAND "CIRCLE" DR10 SC )
(COMMAND "LINE" DR11 DR13 "")
(COMMAND "LINE" DR12 DR14 "")
(IF (= ANS "Y")
    (COMMAND "TRIM" DR15 DR16 "" (POLAR P2 (+ AG1 AG2) 1) "")
)
(COMMAND "LAYER" "SET" WT3CEN "")
(COMMAND "LINE" (POLAR P1 AG1 (* -1 (+ LC 1))) (POLAR P1 AG1 (+ 1 LSE)) "")
(COMMAND "LINE" DR17 DR18 "")
