(DEFUN C:EG3()
(COMMAND "SETVAR" "CMDECHO" 0)
;SET LAYER
(SETQ NY (GETVAR "CLAYER"))
;(IF (= (TYPE F1) 'FILE ) "YES"  (STOP))
;(IF (= (TYPE F2) 'FILE ) "YES" (STOP))
(setq EGSET (findfile "C:/ACAD/ACAD/SUPPORT/EG.SET"))
(IF (= EGSET NIL)
    (PROGN
       (PROMPT "\nPLEASE SETTING LAYER GIUDE PIN :" )
       (SETQ FC (OPEN "C:/ACAD/ACAD/SUPPORT/EG.SET" "w"))
       (setq EGCNT (GETSTRING T"\nSETTING E.G PIN  LAYER OF CONTNIUE LINE ? <0>:"))
       (IF (= EGCNT "")
              (WRITE-LINE "0" FC)
              (WRITE-LINE EGCNT FC)
       )
       (setq EGCEN (GETSTRING T"\nSETTING E.G PIN LAYER OF CENTER LINE ? <CEN>:"))
       (IF (= EGCEN "")
              (WRITE-LINE "CEN" FC)
              (WRITE-LINE EGCEN FC)
       )
       (setq EGHID (GETSTRING T"\nSETTING E.G PIN LAYER OF HIDDEN LINE ? <HID>:"))
       (IF (= EGHID "")
              (WRITE-LINE "HID" FC)
              (WRITE-LINE EGHID FC)
       )
       (setq EGDIM (GETSTRING T"\nSETTING E.G PIN WORD IS LP OR EG ? <EG>:"))
       (IF (= EGDIM "")
              (WRITE-LINE "EG" FC)
              (WRITE-LINE EGDIM FC)
       )
       (setq EGTXT (GETSTRING T"\nSETTING E.G PIN LAYER OF TEXT ? <TEXT>:"))
       (IF (= EGTXT "")
              (WRITE-LINE "TEXT" FC)
              (WRITE-LINE EGTXT FC)
       )
       (CLOSE FC)
    )
)

(IF (/= EGSET NIL)
    (PROGN
       (SETQ FC (OPEN "C:/ACAD/ACAD/SUPPORT/EG.SET" "r"))
       (SETQ EGCNT (READ-LINE FC))
       (SETQ EGCEN (READ-LINE FC))
       (SETQ EGHID (READ-LINE FC))
       (SETQ EGDIM (READ-LINE FC))
       (SETQ EGTXT (READ-LINE FC))
       (IF (OR (= EGCNT "") (= EGCEN "") (= EGHID "") (= EGDIM "") (= EGTXT "")
               (= EGCNT NIL) (= EGCEN NIL) (= EGHID NIL) (= EGDIM NIL) (= EGTXT NIL))
           (CLOSE FC)
       )
       (IF (OR (= EGCNT "") (= EGCEN "") (= EGHID "") (= EGDIM "") (= EGTXT "")
               (= EGCNT NIL) (= EGCEN NIL) (= EGHID NIL) (= EGDIM NIL) (= EGTXT NIL))
           (PROGN
              (PROMPT "\nPLEASE SETTING LAYER E.G PIN :" )
              (SETQ FC (OPEN "C:/ACAD/ACAD/SUPPORT/EG.SET" "w"))
              (setq EGCNT (GETSTRING T"\nSETTING E.G PIN  LAYER OF CONTNIUE LINE ? <0>:"))
              (IF (= EGCNT "")
                  (WRITE-LINE "0" FC)
                  (WRITE-LINE EGCNT FC)
              )
              (setq EGCEN (GETSTRING T"\nSETTING E.G PIN LAYER OF CENTER LINE ? <CEN>:"))
              (IF (= EGCEN "")
                  (WRITE-LINE "CEN" FC)
                  (WRITE-LINE EGCEN FC)
              )
              (setq EGHID (GETSTRING T"\nSETTING E.G PIN LAYER OF HIDDEN LINE ? <HID>:"))
              (IF (= EGHID "")
                  (WRITE-LINE "HID" FC)
                  (WRITE-LINE EGHID FC)
              )
              (setq EGDIM (GETSTRING T"\nSETTING E.G PIN WORD IS LP OR EG ? <EG>:"))
              (IF (= EGDIM "")
                  (WRITE-LINE "EG" FC)
                  (WRITE-LINE EGDIM FC)
              )
              (setq EGTXT (GETSTRING T"\nSETTING E.G PIN LAYER OF TEXT ? <TEXT>:"))
              (IF (= EGTXT "")
                  (WRITE-LINE "TEXT" FC)
                  (WRITE-LINE EGTXT FC)
              )
           (CLOSE FC)
           )
       )
       (SETQ FC (OPEN "C:/ACAD/ACAD/SUPPORT/EG.SET" "r"))
       (SETQ EGCNT (READ-LINE FC))
       (SETQ EGCEN (READ-LINE FC))
       (SETQ EGHID (READ-LINE FC))
       (SETQ EGDIM (READ-LINE FC))
       (SETQ EGTXT (READ-LINE FC))
       (CLOSE FC)
       (PROMPT "\nE.G PIN CONTINUE OF LAYER IS:" )(PROMPT EGCNT)(TERPRI)
       (PROMPT "\nE.G PIN CENTER OF LAYER IS:" ) (PROMPT EGCEN)(TERPRI)
       (PROMPT "\nE.G PIN HIDDEN OF LAYER IS:" ) (PROMPT EGHID)(TERPRI)
       (PROMPT "\nE.G PIN DIMENSION OF LAYER IS:" ) (PROMPT EGDIM)(TERPRI)
       (PROMPT "\nE.G PIN TEXT   OF LAYER IS:" ) (PROMPT EGTXT)(TERPRI)
    )
)



;THE POINT IS FIST COUNTER Y THEN X
(COMMAND "LAYER" "SET" EGCNT "")
(MENUCMD "S=EG")
;(COMMAND "UJ" "")
(GRAPHSCR) (TERPRI)                                     ;GRAPHICS MODE
;(SETQ D 16)
(SETQ D (GETREAL"\nSelect dim:"))
(IF  (= (SETQ ANS1 (GETSTRING "\nDOU YOU WANT TO TRIM P2 LINE:<Y>")) "")
     (SETQ ANS1 "Y")
)
(SETQ ANS1 (STRCASE ANS1))
(IF (= D 16)
    (PROGN
       (SETQ BD 20)
       (SETQ H  6)
       (SETQ M  8)
       (SETQ TOPL  3.0)
       (SETQ TOPR  1.5)
       (SETQ TOPC  1.0)
       (SETQ BUD 30)
       (SETQ BUD1 25)
       (SETQ BUH  6)
       (SETQ BUR  3)
       (SETQ W 3  )
       (SETQ P 16)
     )
)
(IF (= D 20)
    (PROGN
       (SETQ BD 25)
       (SETQ H  6)
       (SETQ M  10)
       (SETQ TOPL  3.0)
       (SETQ TOPR  1.5)
       (SETQ TOPC  1.0)
       (SETQ BUD 35)
       (SETQ BUD1 30)
       (SETQ BUH  8)
       (SETQ BUR  3)
       (SETQ W 3  )
       (SETQ P 20)
     )
)
(IF (= D 25)
    (PROGN
       (SETQ BD 30)
       (SETQ H  8)
       (SETQ M  12)
       (SETQ TOPL  3.0)
       (SETQ TOPR  1.5)
       (SETQ TOPC  1.0)
       (SETQ BUD 40)
       (SETQ BUD1 35)
       (SETQ BUH  8)
       (SETQ BUR  3)
       (SETQ W 3  )
       (SETQ P 25)
     )
)
(IF (= D 30)
    (PROGN
       (SETQ BD 35)
       (SETQ H  8)
       (SETQ M  15)
       (SETQ TOPL  3.0)
       (SETQ TOPR  1.5)
       (SETQ TOPC  1.0)
       (SETQ BUD 47)
       (SETQ BUD1 42)
       (SETQ BUH 10)
       (SETQ BUR  3)
       (SETQ W 3  )
       (SETQ P 30)
     )
)
(IF (= D 35)
    (PROGN
       (SETQ BD 40)
       (SETQ H  8)
       (SETQ M  15)
       (SETQ TOPL  3.0)
       (SETQ TOPR  1.5)
       (SETQ TOPC  1.0)
       (SETQ BUD 54)
       (SETQ BUD1 48)
       (SETQ BUH 10)
       (SETQ BUR  4)
       (SETQ W 4  )
       (SETQ P 30)
     )
)
(IF (= D 40)
    (PROGN
       (SETQ BD 45)
       (SETQ H  10)
       (SETQ M  20)
       (SETQ TOPL  3.0)
       (SETQ TOPR  1.5)
       (SETQ TOPC  1.0)
       (SETQ BUD 61)
       (SETQ BUD1 55)
       (SETQ BUH 10)
       (SETQ BUR  4)
       (SETQ W 4  )
       (SETQ P 40)
     )
)
(IF (= D 50)
    (PROGN
       (SETQ BD 56)
       (SETQ H  12)
       (SETQ M  25)
       (SETQ TOPL  3.0)
       (SETQ TOPR  1.5)
       (SETQ TOPC  1.0)
       (SETQ BUD 76)
       (SETQ BUD1 70)
       (SETQ BUH 12)
       (SETQ BUR  4)
       (SETQ W 4  )
       (SETQ P 50)
     )
)
(IF (= D 60)
    (PROGN
       (SETQ BD 66)
       (SETQ H  15)
       (SETQ M  25)
       (SETQ TOPL  3.0)
       (SETQ TOPR  1.5)
       (SETQ TOPC  1.0)
       (SETQ BUD 86)
       (SETQ BUD1 80)
       (SETQ BUH 12)
       (SETQ BUR  4)
       (SETQ W 4  )
       (SETQ P 60)
     )
)
(IF (= D 70)
    (PROGN
       (SETQ BD 76)
       (SETQ H  15)
       (SETQ M  25)
       (SETQ TOPL  3.0)
       (SETQ TOPR  1.5)
       (SETQ TOPC  1.0)
       (SETQ BUD 96)
       (SETQ BUD1 90)
       (SETQ BUH 12)
       (SETQ BUR  4)
       (SETQ W 4  )
       (SETQ P 70)
     )
)
(IF (= D 80)
    (PROGN
       (SETQ BD 86)
       (SETQ H  15)
       (SETQ M  25)
       (SETQ TOPL  3.0)
       (SETQ TOPR  1.5)
       (SETQ TOPC  1.0)
       (SETQ BUD 105)
       (SETQ BUD1 100)
       (SETQ BUH 12)
       (SETQ BUR  4)
       (SETQ W 4  )
       (SETQ P 80)
     )
)

(SETQ P1 (GETPOINT "\nP1:"))
(SETQ P2 (GETPOINT P1 "\nP2:"))
(SETQ P3 (GETPOINT P2 "\nP3:"))
(SETQ P4 (GETPOINT P3 "\nP4:"))
(SETQ P5 (GETPOINT P4 "\nP5:"))
(SETQ P6 (GETPOINT P5 "\nP6:"))
;(SETQ P1 (LIST -2093 -550.8))
;(SETQ P2 (LIST -2093 -520.8))
;(SETQ P3 (LIST -2093 -515.8))
;(SETQ P4 (LIST -2093 -490.8))
;(SETQ P5 (LIST -2093 -470.8))
;(SETQ P6 (LIST -2093 -420.8))
(SETQ AG1 (ANGLE P1 P2))
(SETQ AG2 (* PI 0.5))
(SETQ DR1 (POLAR (POLAR P1 AG1 H) (+ AG1 AG2) (+ (/ BD 2.0) 1)))
(SETQ DR2 (POLAR (POLAR P1 AG1 H) (- AG1 AG2) (+ (/ BD 2.0) 1)))
(SETQ DR3 (POLAR P1 (+ AG1 AG2) (+ (/ BD 2.0) 1)))
(SETQ DR4 (POLAR P1 (- AG1 AG2) (+ (/ BD 2.0) 1)))
(SETQ DR5 (POLAR (POLAR P1 AG1 H) (+ AG1 AG2) (/ BD 2.0)))
(SETQ DR6 (POLAR (POLAR P1 AG1 H) (- AG1 AG2) (/ BD 2.0)))
(SETQ DR7 (POLAR (POLAR P1 AG1 1) (+ AG1 AG2) (/ BD 2.0)))
(SETQ DR8 (POLAR (POLAR P1 AG1 1) (- AG1 AG2) (/ BD 2.0)))
(SETQ DR7-1 (POLAR (POLAR P1 AG1 0) (+ AG1 AG2) (- (/ BD 2.0) 1)))
(SETQ DR8-1 (POLAR (POLAR P1 AG1 0) (- AG1 AG2) (- (/ BD 2.0) 1)))

;ABOVE FIRST BOX
(SETQ LSE (DISTANCE P1 P6)) ;DIST FOR P1 P6
(SETQ LS2 (DISTANCE P1 P2)) ;DIST FOR P1 P2
(SETQ LS3 (DISTANCE P1 P3)) ;DIST FOR P1 P3
(SETQ LS4 (DISTANCE P1 P4)) ;DIST FOR P1 P4
(SETQ LS5 (DISTANCE P1 P5)) ;DIST FOR P1 P5

(SETQ DR9 (POLAR (POLAR P1 AG1 (+ H 3))  (+ AG1 AG2) (/ D 2.0)))
(SETQ DR10 (POLAR (POLAR P1 AG1 (+ H 3)) (- AG1 AG2) (/ D 2.0)))
(SETQ DR11 (POLAR (POLAR P1 AG1 (+ H 3)) (+ AG1 AG2) (- (/ D 2.0) 0.5)))
(SETQ DR12 (POLAR (POLAR P1 AG1 (+ H 3)) (- AG1 AG2) (- (/ D 2.0) 0.5)))
(SETQ DR13 (POLAR (POLAR P1 AG1 H) (+ AG1 AG2) (- (/ D 2.0) 0.5)))
(SETQ DR14 (POLAR (POLAR P1 AG1 H) (- AG1 AG2) (- (/ D 2.0) 0.5)))
(SETQ DR15 (POLAR (POLAR P1 AG1 H ) (+ AG1 AG2) (/ D 2.0)))
(SETQ DR16 (POLAR (POLAR P1 AG1 H ) (- AG1 AG2) (/ D 2.0)))
(SETQ DR17-1 (POLAR (POLAR P1 AG1 (+ LSE 15)) (+ AG1 AG2) (/ D 2.0)))
(SETQ DR18-1 (POLAR (POLAR P1 AG1 (+ LSE 15)) (- AG1 AG2) (/ D 2.0)))
(SETQ DR17 (POLAR (POLAR P1 AG1 (- (+ LSE 15) TOPR)) (+ AG1 AG2) (/ D 2.0)))
(SETQ DR18 (POLAR (POLAR P1 AG1 (- (+ LSE 15) TOPR)) (- AG1 AG2) (/ D 2.0)))
(SETQ DR19 (POLAR (POLAR P1 AG1 LSE) (+ AG1 AG2) (/ BUD1 2.0)))
(SETQ DR20 (POLAR (POLAR P1 AG1 LSE) (- AG1 AG2) (/ BUD1 2.0)))
(SETQ DR21 (POLAR (POLAR P1 AG1 (+ LSE 15)) (+ AG1 AG2) (/ BUD1 2.0)))
(SETQ DR22 (POLAR (POLAR P1 AG1 (+ LSE 15)) (- AG1 AG2) (/ BUD1 2.0)))
(SETQ DR23 (POLAR (POLAR P1 AG1 (+ LSE 15)) (+ AG1 AG2) (+ (/ D 2.0) TOPR)))
(SETQ DR24 (POLAR (POLAR P1 AG1 (+ LSE 15)) (- AG1 AG2) (+ (/ D 2.0) TOPR)))
(SETQ DR25 (POLAR (POLAR P1 AG1 (+ LSE 15)) (+ AG1 AG2) (- (/ D 2.0) TOPR)))
(SETQ DR26 (POLAR (POLAR P1 AG1 (+ LSE 15)) (- AG1 AG2) (- (/ D 2.0) TOPR)))
(SETQ INT1 (POLAR (POLAR P1 AG1 (+ LSE 15)) (+ AG1 AG2) (- (/ D 2.0) 2)))
(SETQ INT2 (POLAR (POLAR P1 AG1 (+ LSE 15)) (- AG1 AG2) (- (/ D 2.0) 2)))
(SETQ DR27 (POLAR INT1 (- AG1 (DTR 60)) TOPL))
(SETQ DR28 (POLAR INT2 (+ AG1 (DTR 60)) TOPL))
(SETQ DRTOPL (INTERS INT1 DR27 INT2 DR28 NIL))
(SETQ DR29 (POLAR (POLAR P1 AG1 (+ LSE TOPC 1)) (+ AG1 AG2) (/ BUD1 2.0)))
(SETQ DR30 (POLAR (POLAR P1 AG1 (+ LSE TOPC 1)) (- AG1 AG2) (/ BUD1 2.0)))
(SETQ DR31 (POLAR (POLAR P1 AG1 (+ LSE 1)) (+ AG1 AG2) (- (/ BUD1 2.0) 1)))
(SETQ DR32 (POLAR (POLAR P1 AG1 (+ LSE 1)) (- AG1 AG2) (- (/ BUD1 2.0) 1)))
(SETQ DR33 (POLAR (POLAR P1 AG1 (+ LSE 1)) (+ AG1 AG2) (/ D 2.0)))
(SETQ DR34 (POLAR (POLAR P1 AG1 (+ LSE 1)) (- AG1 AG2) (/ D 2.0)))
(SETQ DR35 (POLAR (POLAR P1 AG1 (+ LSE 1 TOPR)) (+ AG1 AG2) (/ D 2.0)))
(SETQ DR36 (POLAR (POLAR P1 AG1 (+ LSE 1 TOPR)) (- AG1 AG2) (/ D 2.0)))
(SETQ DR37 (POLAR (POLAR P1 AG1 (+ LSE 1 )) (+ AG1 AG2) (+ (/ D 2.0) TOPR)))
(SETQ DR38 (POLAR (POLAR P1 AG1 (+ LSE 1 )) (- AG1 AG2) (+ (/ D 2.0) TOPR)))
(SETQ DR39 (POLAR (POLAR P1 AG1 LS3 ) (+ AG1 AG2) (/ BUD1 2.0)))
(SETQ DR40 (POLAR (POLAR P1 AG1 LS3 ) (- AG1 AG2) (/ BUD1 2.0)))
(SETQ DR41 (POLAR (POLAR P1 AG1 (- LS4 5)) (+ AG1 AG2) (/ BUD1 2.0)))
(SETQ DR42 (POLAR (POLAR P1 AG1 (- LS4 5)) (- AG1 AG2) (/ BUD1 2.0)))

(SETQ DR43 (POLAR (POLAR P1 AG1 (- LS4 8)) (+ AG1 AG2) (/ BUD1 2.0)))
(SETQ DR44 (POLAR (POLAR P1 AG1 (- LS4 8)) (- AG1 AG2) (/ BUD1 2.0)))
(SETQ DR45 (POLAR (POLAR P1 AG1 (- LS4 8)) (+ AG1 AG2) (- (/ BUD1 2.0) 0.5)))
(SETQ DR46 (POLAR (POLAR P1 AG1 (- LS4 8)) (- AG1 AG2) (- (/ BUD1 2.0) 0.5)))
(SETQ DR47 (POLAR (POLAR P1 AG1 (- LS4 5)) (+ AG1 AG2) (- (/ BUD1 2.0) 0.5)))
(SETQ DR48 (POLAR (POLAR P1 AG1 (- LS4 5)) (- AG1 AG2) (- (/ BUD1 2.0) 0.5)))

(SETQ DR49 (POLAR (POLAR P1 AG1 (- LS4 5)) (+ AG1 AG2) (/ BUD 2.0)))
(SETQ DR50 (POLAR (POLAR P1 AG1 (- LS4 5)) (- AG1 AG2) (/ BUD 2.0)))
(SETQ DR51 (POLAR (POLAR P1 AG1 (- LS4 5)) (+ AG1 AG2) (+ (/ BUD 2.0) 1)))
(SETQ DR52 (POLAR (POLAR P1 AG1 (- LS4 5)) (- AG1 AG2) (+ (/ BUD 2.0) 1)))

(SETQ DR53 (POLAR (POLAR P1 AG1 LS4) (+ AG1 AG2) (/ BUD 2.0)))
(SETQ DR54 (POLAR (POLAR P1 AG1 LS4) (- AG1 AG2) (/ BUD 2.0)))
(SETQ DR55 (POLAR (POLAR P1 AG1 LS4) (+ AG1 AG2) (+ (/ BUD 2.0) 1)))
(SETQ DR56 (POLAR (POLAR P1 AG1 LS4) (- AG1 AG2) (+ (/ BUD 2.0) 1)))

(SETQ DR57 (POLAR (POLAR P1 AG1 LS4) (+ AG1 AG2) (/ BUD1 2.0)))
(SETQ DR58 (POLAR (POLAR P1 AG1 LS4) (- AG1 AG2) (/ BUD1 2.0)))
(SETQ DR59 (POLAR (POLAR P1 AG1 LS5) (+ AG1 AG2) (/ BUD1 2.0)))
(SETQ DR60 (POLAR (POLAR P1 AG1 LS5) (- AG1 AG2) (/ BUD1 2.0)))

(SETQ DR61 (POLAR (POLAR P1 AG1 LS4) (+ AG1 AG2) (- (/ BUD1 2.0) 0.5)))
(SETQ DR62 (POLAR (POLAR P1 AG1 LS4) (- AG1 AG2) (- (/ BUD1 2.0) 0.5)))
(SETQ DR63 (POLAR (POLAR P1 AG1 (+ LS4 3)) (+ AG1 AG2) (- (/ BUD1 2.0) 0.5)))
(SETQ DR64 (POLAR (POLAR P1 AG1 (+ LS4 3)) (- AG1 AG2) (- (/ BUD1 2.0) 0.5)))
(SETQ DR65 (POLAR (POLAR P1 AG1 (+ LS4 3)) (+ AG1 AG2) (/ BUD1 2.0)))
(SETQ DR66 (POLAR (POLAR P1 AG1 (+ LS4 3)) (- AG1 AG2) (/ BUD1 2.0)))

(SETQ DR67 (POLAR (POLAR P1 AG1 (- LS5 1 TOPC)) (+ AG1 AG2) (/ BUD1 2.0)))
(SETQ DR68 (POLAR (POLAR P1 AG1 (- LS5 1 TOPC)) (- AG1 AG2) (/ BUD1 2.0)))
(SETQ DR69 (POLAR (POLAR P1 AG1 (- LS5 1 )) (+ AG1 AG2) (- (/ BUD1 2.0) TOPC)))
(SETQ DR70 (POLAR (POLAR P1 AG1 (- LS5 1 )) (- AG1 AG2) (- (/ BUD1 2.0) TOPC)))
(SETQ DR71 (POLAR (POLAR P1 AG1 (- LS5 1 )) (+ AG1 AG2) (/ D 2.0)))
(SETQ DR72 (POLAR (POLAR P1 AG1 (- LS5 1 )) (- AG1 AG2) (/ D 2.0)))


(SETQ DR73 (POLAR (POLAR P1 AG1 (- LS5 1 )) (+ AG1 AG2) (+ (/ D 2.0) TOPR)))
(SETQ DR74 (POLAR (POLAR P1 AG1 (- LS5 1 )) (- AG1 AG2) (+ (/ D 2.0) TOPR)))
(SETQ DR75 (POLAR (POLAR P1 AG1 (- LS5 1 TOPR)) (+ AG1 AG2) (/ D 2.0)))
(SETQ DR76 (POLAR (POLAR P1 AG1 (- LS5 1 TOPR)) (- AG1 AG2) (/ D 2.0)))


(SETQ DR77 (POLAR (POLAR P1 AG1 (+ LS3 1 TOPC)) (+ AG1 AG2) (/ BUD1 2.0)))
(SETQ DR78 (POLAR (POLAR P1 AG1 (+ LS3 1 TOPC)) (- AG1 AG2) (/ BUD1 2.0)))
(SETQ DR79 (POLAR (POLAR P1 AG1 (+ LS3 1 )) (+ AG1 AG2) (- (/ BUD1 2.0) 1)))
(SETQ DR80 (POLAR (POLAR P1 AG1 (+ LS3 1 )) (- AG1 AG2) (- (/ BUD1 2.0) 1)))
(SETQ DR81 (POLAR (POLAR P1 AG1 (+ LS3 1 )) (+ AG1 AG2) (/ D 2.0)))
(SETQ DR82 (POLAR (POLAR P1 AG1 (+ LS3 1 )) (- AG1 AG2) (/ D 2.0)))
(SETQ DR83 (POLAR (POLAR P1 AG1 (+ LS3 1 )) (+ AG1 AG2) (+ (/ D 2.0) TOPR)))
(SETQ DR84 (POLAR (POLAR P1 AG1 (+ LS3 1 )) (- AG1 AG2) (+ (/ D 2.0) TOPR)))
(SETQ DR85 (POLAR (POLAR P1 AG1 (+ LS3 1 TOPR)) (+ AG1 AG2) (/ D 2.0)))
(SETQ DR86 (POLAR (POLAR P1 AG1 (+ LS3 1 TOPR)) (- AG1 AG2) (/ D 2.0)))

(SETQ DR87 (POLAR (POLAR P2 AG1 -1) (+ AG1 AG2) (/ D 2.0)))
(SETQ DR88 (POLAR (POLAR P2 AG1 -1) (- AG1 AG2) (/ D 2.0)))
;
(IF  (= ANS1 "N")
     (COMMAND "LAYER" "SET" EGHID "")
     (COMMAND "LAYER" "SET" EGCNT "")
)
(COMMAND "LINE" DR1 DR2 "")
(COMMAND "LINE" DR1 DR3 "")
(COMMAND "LINE" DR2 DR4 "")
(COMMAND "LINE" DR5 DR7 "")
(COMMAND "LINE" DR6 DR8 "")
(COMMAND "LINE" DR7 DR8 "")
(COMMAND "LINE" DR7 DR7-1 "")
(COMMAND "LINE" DR8 DR8-1 "")
;BOX ABOVE

(COMMAND "LINE" DR9 DR10 "")
(COMMAND "LINE" DR11 DR13 "")
(COMMAND "LINE" DR12 DR14 "")
;(COMMAND "LINE" DR15 DR17 "")
(COMMAND "LINE" DR15 DR17-1 "")
(COMMAND "LINE" DR16 DR18-1 "")
(COMMAND "LINE" DR17-1 DR18-1 "")
;(COMMAND "LINE" DR16 DR18 "")
;(COMMAND "LINE" DR19 DR21 "")
;(COMMAND "LINE" DR20 DR22 "")
;(COMMAND "LINE" DR21 DR22 "")
;(COMMAND "ARC" DR17 "E" DR23 "R" TOPR)
;(COMMAND "ARC" DR24 "E" DR18 "R" TOPR)
(COMMAND "ARC" DR25 "E" DR17 "R" TOPR)
(COMMAND "ARC" DR18 "E" DR26 "R" TOPR)
(COMMAND "LINE" DRTOPL INT1 "")
(COMMAND "LINE" DRTOPL INT2 "")
;(COMMAND "LINE" DR29 DR31 DR33 "")
;(COMMAND "LINE" DR30 DR32 DR34 "")
;(COMMAND "ARC" DR37 "E" DR35 "R" TOPR)
;(COMMAND "ARC" DR36 "E" DR38 "R" TOPR)
(COMMAND "LINE" DR39 DR41 "")
(COMMAND "LINE" DR40 DR42 "")
(COMMAND "LINE" DR43 DR45 DR47 "")
(COMMAND "LINE" DR44 DR46 DR48 "")
(COMMAND "LINE" DR47 DR51 DR55 "")
(COMMAND "LINE" DR48 DR52 DR56 "")
(COMMAND "LINE" DR49 DR53 "")
(COMMAND "LINE" DR50 DR54 "")
(COMMAND "LINE" DR57 DR59 "")
(COMMAND "LINE" DR58 DR60 "")
(COMMAND "LINE" DR57 DR61 DR63 DR65 "")
(COMMAND "LINE" DR58 DR62 DR64 DR66 "")
(COMMAND "LINE" DR67 DR69 DR71 "")
(COMMAND "LINE" DR68 DR70 DR72 "")
(COMMAND "ARC" DR75 "E" DR73 "R" TOPR)
(COMMAND "ARC" DR74 "E" DR76 "R" TOPR)
(COMMAND "LINE" DR77 DR79 DR81 "")
(COMMAND "LINE" DR78 DR80 DR82 "")
(COMMAND "ARC" DR83 "E" DR85 "R" TOPR)
(COMMAND "ARC" DR86 "E" DR84 "R" TOPR)

;HERE
(SETQ DR89 (POLAR DR9 AG1 3))
(SETQ DR90 (POLAR DR10 AG1 3))
(IF (= ANS1 "Y")
    (PROGN
      (COMMAND "TRIM" DR89 DR90 "" (POLAR P2 (+ AG1 AG2) 4)
      (POLAR P3 (+ AG1 AG2) 4)
      (POLAR P4 (+ AG1 AG2) 4)
      (POLAR P5 (+ AG1 AG2) 4)
      (POLAR P6 (+ AG1 AG2) 4) "")
    )
)
(COMMAND "LINE" DR87 DR88 "")
(COMMAND "LAYER" "SET" EGCEN "")
(COMMAND "LINE" (POLAR P1 AG1 -1) (POLAR DRTOPL AG1 1) "")
(COMMAND "LAYER" "SET" NY "")
)
