(DEFUN C:D2o()
(SETQ NLY (GETVAR "CLAYER"))
(setq STOP2SET (findfile "c:/acad/hon/set/STOP2.SET"))
(IF (= STOP2SET NIL)
    (PROGN
       (PROMPT "\nPLEASE SETTING LAYER STOP2 :" )
       (SETQ FC (OPEN "c:/acad/hon/set/STOP2.SET" "w"))
       (setq STOP2CNT (GETSTRING T"\nSETTING STOP2 LAYER OF CONTNIUE LINE/<0>:"))
       (IF (= STOP2CNT "")
              (WRITE-LINE "0" FC)
              (WRITE-LINE STOP2CNT FC)
       )
       (setq STOP2CEN (GETSTRING T"\nSETTING STOP2 LAYER OF CENTER LINE/<CEN>:"))
       (IF (= STOP2CEN "")
              (WRITE-LINE "CEN" FC)
              (WRITE-LINE STOP2CEN FC)
       )
       (setq STOP2HID (GETSTRING T"\nSETTING STOP2 LAYER OF HIDDEN LINE/<HID>:"))
       (IF (= STOP2HID "")
              (WRITE-LINE "HID" FC)
              (WRITE-LINE STOP2HID FC)
       )
       (setq STOP2DIM (GETSTRING T"\nSETTING STOP2 LAYER OF DIMESION /<DIM1>:"))
       (IF (= STOP2DIM "")
              (WRITE-LINE "DIM1" FC)
              (WRITE-LINE STOP2DIM FC)
       )
       (setq STOP2TXT (GETSTRING T"\nSETTING STOP2 LAYER OF TEXT /<TEXT>:"))
       (IF (= STOP2TXT "")
              (WRITE-LINE "TEXT" FC)
              (WRITE-LINE STOP2TXT FC)
       )
       (CLOSE FC)
    )
)

(IF (/= STOP2SET NIL)
    (PROGN
       (SETQ FC (OPEN "c:/acad/hon/set/STOP2.SET" "r"))
       (SETQ STOP2CNT (READ-LINE FC))
       (SETQ STOP2CEN (READ-LINE FC))
       (SETQ STOP2HID (READ-LINE FC))
       (SETQ STOP2DIM (READ-LINE FC))
       (SETQ STOP2TXT (READ-LINE FC))
       (IF (OR (= STOP2CNT "") (= STOP2CEN "") (= STOP2HID "") (= STOP2DIM "") (= STOP2TXT "")
               (= STOP2CNT NIL) (= STOP2CEN NIL) (= STOP2HID NIL) (= STOP2DIM NIL) (= STOP2TXT NIL))
           (CLOSE FC)
       )
(IF (OR (= STOP2CNT "") (= STOP2CEN "") (= STOP2HID "") (= STOP2DIM "") (= STOP2TXT "")
               (= STOP2CNT NIL) (= STOP2CEN NIL) (= STOP2HID NIL) (= STOP2DIM NIL) (= STOP2TXT NIL))
           (PROGN
              (PROMPT "\nPLEASE SETTING LAYER OF SCREW :" )
              (SETQ FC (OPEN "c:/acad/hon/set/STOP2.SET" "w"))
              (setq STOP2CNT (GETSTRING T"\nSETTING STOP2 LAYER OF CONTNIUE LINE/<0>:"))
              (IF (= STOP2CNT "")
                  (WRITE-LINE "0" FC)
                  (WRITE-LINE STOP2CNT FC)
              )
              (setq STOP2CEN (GETSTRING T"\nSETTING STOP2 LAYER OF CENTER LINE/<CEN>:"))
              (IF (= STOP2CEN "")
                  (WRITE-LINE "CEN" FC)
                  (WRITE-LINE STOP2CEN FC)
              )
              (setq STOP2HID (GETSTRING T"\nSETTING STOP2 LAYER OF HIDDEN LINE/<HID>:"))
              (IF (= STOP2HID "")
                  (WRITE-LINE "HID" FC)
                  (WRITE-LINE STOP2HID FC)
              )
              (setq STOP2DIM (GETSTRING T"\nSETTING STOP2 LAYER OF DIMESION/<DIM1>:"))
              (IF (= STOP2DIM "")
                  (WRITE-LINE "DIM1" FC)
                  (WRITE-LINE STOP2DIM FC)
              )
              (setq STOP2TXT (GETSTRING T"\nSETTING STOP2 LAYER OF TEXT /<TEXT>:"))
              (IF (= STOP2TXT "")
                  (WRITE-LINE "TEXT" FC)
                  (WRITE-LINE STOP2TXT FC)
              )
           (CLOSE FC)
           )
       )
       (SETQ FC (OPEN "c:/acad/hon/set/STOP2.SET" "r"))
       (SETQ STOP2CNT (READ-LINE FC))
       (SETQ STOP2CEN (READ-LINE FC))
       (SETQ STOP2HID (READ-LINE FC))
       (SETQ STOP2DIM (READ-LINE FC))
       (SETQ STOP2TXT (READ-LINE FC))
       (CLOSE FC)
       (PROMPT "\nSCREW CONTINUE OF LAYER IS:" )(PROMPT STOP2CNT)(TERPRI)
       (PROMPT "\nSCREW CENTER OF LAYER IS:" ) (PROMPT STOP2CEN)(TERPRI)
       (PROMPT "\nSCREW HIDDEN OF LAYER IS:" ) (PROMPT STOP2HID)(TERPRI)
       (PROMPT "\nSCREW DIMENSION OF LAYER IS:" ) (PROMPT STOP2DIM)(TERPRI)
       (PROMPT "\nSCREW TEXT   OF LAYER IS:" ) (PROMPT STOP2TXT)(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/STOP2.SET" "w"))
       (PROMPT "\nSCREW CONTINUE OF LAYER <" )(PROMPT STOP2CNT)(PROMPT">:")
       (setq STOP2CNT (GETSTRING T))
       (IF (= STOP2CNT "")
              (WRITE-LINE "0" FC)
              (WRITE-LINE STOP2CNT FC)
       )
       (PROMPT "\nSCREW CENTER OF LAYER <" )(PROMPT STOP2CEN)(PROMPT">:")
       (setq STOP2CEN (GETSTRING T))
       (IF (= STOP2CEN "")
              (WRITE-LINE "CEN" FC)
              (WRITE-LINE STOP2CEN FC)
       )
       (PROMPT "\nSCREW HIDDEN OF LAYER <" )(PROMPT STOP2HID)(PROMPT">:")
       (setq STOP2HID (GETSTRING T))
       (IF (= STOP2HID "")
              (WRITE-LINE "HID" FC)
              (WRITE-LINE STOP2HID FC)
       )
       (PROMPT "\nSCREW DIMESION OF LAYER <" )(PROMPT STOP2DIM)(PROMPT">:")
       (setq STOP2DIM (GETSTRING T))
       (IF (= STOP2DIM "")
              (WRITE-LINE "DIM1" FC)
              (WRITE-LINE STOP2DIM FC)
       )
       (PROMPT "\nSCREW TEXT OF LAYER <" )(PROMPT STOP2TXT)(PROMPT">:")
       (setq STOP2TXT (GETSTRING T))
       (IF (= STOP2TXT "")
              (WRITE-LINE "TEXT" FC)
              (WRITE-LINE STOP2TXT FC)
       )
       (CLOSE FC)
       (SETQ FC (OPEN "c:/acad/hon/set/STOP2.SET" "r"))
      (SETQ STOP2CNT (READ-LINE FC))
       (SETQ STOP2CEN (READ-LINE FC))
       (SETQ STOP2HID (READ-LINE FC))
       (SETQ STOP2DIM (READ-LINE FC))
       (SETQ STOP2TXT (READ-LINE FC))
       (CLOSE FC)
       (PROMPT "\nSCREW CONTINUE OF LAYER NOW IS:" )(PROMPT STOP2CNT)(TERPRI)
       (PROMPT "\nSCREW CENTER   OF LAYER NOW IS:" ) (PROMPT STOP2CEN)(TERPRI)
       (PROMPT "\nSCREW HIDDEN   OF LAYER NOW IS:" ) (PROMPT STOP2HID)(TERPRI)
       (PROMPT "\nSCREW DIM      OF LAYER NOW IS:" ) (PROMPT STOP2DIM)(TERPRI)
       (PROMPT "\nSCREW TEXT     OF LAYER NOW  IS:" ) (PROMPT STOP2TXT)(TERPRI)
  )
)
(MENUCMD "S=X")
(MENUCMD "S=D11")

   (COMMAND "VSLIDE" "c:/acad/HON/B/D2O")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(SETQ DIM (GETREAL"\nPLEASE SLECT THE DIM OF THE ENTITY:(DIM1~DIM6)::(1)"))

(IF (OR ( = DIM "") (= DIM NIL) )
(PROGN
     (SETQ DIM 1 )

                  ))

     (IF (= DIM 1 )
   (PROGN
      ( SETQ A 6.0  )
      ( SETQ B 4.0  )
     ( SETQ C 2.0  )
      ( SETQ P  1.3  )
      ( SETQ G  1.15 )
     ( SETQ T  0.9 )
     ( SETQ D1 0.5 )
      ( SETQ D2 1.0  )
      ( SETQ D3 0.5  )
     ( SETQ D4 1.0 )
     ( SETQ D5 0.5 )
    ( SETQ PF 1.4 )
     ))
     (IF (= DIM 2 )
   (PROGN
      ( SETQ A 6.0  )
      ( SETQ B 4.5  )
     ( SETQ C 2.5  )
      ( SETQ P  1.65 )
      ( SETQ G  1.65 )
     ( SETQ T  1.15 )
     ( SETQ D1 0.5 )
      ( SETQ D2 1.0  )
      ( SETQ D3 0.5  )
     ( SETQ D4 1.0 )
     ( SETQ D5 0.5 )
 ( SETQ PF 1.65 )
     ))

     (IF (= DIM 3 )
   (PROGN
      ( SETQ A 6.0  )
      ( SETQ B 5.0  )
     ( SETQ C 3.0  )
      ( SETQ P  1.9  )
      ( SETQ G  1.5  )
     ( SETQ T  1.4 )
     ( SETQ D1 0.5 )
      ( SETQ D2 1.0  )
      ( SETQ D3 0.5  )
     ( SETQ D4 1.0 )
     ( SETQ D5 0.5 )
 ( SETQ PF 1.9 )
     ))
     (IF (= DIM 4 )
   (PROGN
      ( SETQ A 8.0  )
      ( SETQ B 6.5  )
     ( SETQ C 4.0  )
      ( SETQ P  2.4  )
      ( SETQ G  2.0  )
     ( SETQ T  0.9 )
     ( SETQ D1 0.8 )
      ( SETQ D2 0.4  )
      ( SETQ D3 0.8  )
     ( SETQ D4 1.0 )
     ( SETQ D5 0.5 )
 ( SETQ PF 2.4 )
     ))
     (IF (= DIM 5 )
   (PROGN
      ( SETQ A 8.0  )
      ( SETQ B 7.5  )
     ( SETQ C 5.0  )
      ( SETQ P  2.9  )
      ( SETQ G  2.4  )
     ( SETQ T  2.4 )
     ( SETQ D1 0.8 )
      ( SETQ D2 0.4  )
      ( SETQ D3 0.8  )
     ( SETQ D4 1.0 )
     ( SETQ D5 0.5 )
 ( SETQ PF 2.9 )
     ))
     (IF (= DIM 6 )
   (PROGN
      ( SETQ A 8.0  )
      ( SETQ B 8.5  )
     ( SETQ C 6.0  )
      ( SETQ P  3.6  )
      ( SETQ G  3.1  )
     ( SETQ T  3.1 )
     ( SETQ D1 0.8 )
      ( SETQ D2 0.4  )
      ( SETQ D3 0.8  )
     ( SETQ D4 1.0 )
     ( SETQ D5 0.5 )
 ( SETQ PF 3.6 )
     ))
   (COMMAND "REDRAW")
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (SETQ P1 (GETPOINT"\n SLECT P1 BASE POINT:"))
  (SETQ P2 (GETPOINT P1"\n SELECT P2 BASE POINT:"))
  (SETQ AG1 (ANGLE P1 P2 ) )
  (SETQ AG2 (* PI 0.5 ))
 (SETQ P3 (GETPOINT P2"\n SELECT P3  BASE POINT:"))
      (COMMAND "LAYER" "S" STOP2CNT  "")
(SETQ PLENGTH (DISTANCE P1 P3 ))
;(SETQ D   (- PLENGTH (+ A D1 ) ))
 (SETQ D   (- PLENGTH (+ A    ) ))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (SETQ DR1   (POLAR P1  (- AG1 AG2 )     B              )      )
 (SETQ DR2   (POLAR DR1    AG1      A              )      )
 (SETQ DR3   (POLAR DR2   (+ AG1 AG2 )  (- B C )          )      )
 (SETQ DR4   (POLAR DR3      AG1           D              )      )
 (SETQ DR11  (POLAR P1  (+ AG1 AG2 )     B              )      )
 (SETQ DR22  (POLAR DR11   AG1      A              )      )
 (SETQ DR33  (POLAR DR22  (-  AG1 AG2 )  (- B C )          )      )
 (SETQ DR44  (POLAR DR33     AG1           D              )      )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (SETQ  H1   (POLAR DR1 (- AG1 AG2 )         0.5      ))
  (SETQ  H2   (POLAR DR2 (- AG1 AG2 )   0.5     ))
  (SETQ  H3   (POLAR DR3 (- AG1 AG2 )   0.5         )      )
  (SETQ  H4   (POLAR P2  (- AG1 AG2 )  (+ C 0.5 )     )      )
  (SETQ  H11  (POLAR DR11 (+ AG1 AG2 )         0.5      ))
  (SETQ  H22  (POLAR DR22 (+ AG1 AG2 )   0.5     ))
  (SETQ  H33  (POLAR DR33 (+ AG1 AG2 )   0.5         )      )
  (SETQ  H44  (POLAR P2   (+ AG1 AG2 ) (+ C 0.5  )   )      )
       (COMMAND "LAYER" "S" STOP2CNT  "")
 (COMMAND "LINE" H1 H2 "")
 (COMMAND "LINE"  H11 H22  "")
 (COMMAND "LINE" H3 H4  "")
 (COMMAND "LINE" H33 H44 "")
 (COMMAND "LINE" H2  H22 "")
 (command "break" h4 h44  )
 (SETQ p4    (POLAR P1     AG1     (+ a d )     )      )
 (SETQ p5    (POLAR p4     AG1       d1           )      )
 (SETQ p6    (POLAR p5       AG1      d2                  )      )
 (SETQ p7    (POLAR p6       AG1   d3                     )      )
 (SETQ p8    (POLAR p7       AG1   d4                     )      )
 (SETQ p9    (POLAR p8       AG1   d5                     )      )
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (SETQ cr1   (POLAR p4    (- AG1 AG2 )   P                      )      )
 (SETQ CR2   (POLAR p5    (- AG1 AG2 )  G                      )      )
 (SETQ CR3   (POLAR p6     (- AG1 AG2 )  G                      )      )
 (SETQ CR4   (POLAR p7     (- AG1 AG2 )  PF                     )      )
 (SETQ CR5   (POLAR p8     (- AG1 AG2 )  PF                     )      )
 (SETQ CR6   (POLAR p9     (- AG1 AG2 )  T                      )      )
 (SETQ cr11   (POLAR p4    (+ AG1 AG2 )   P                      )      )
 (SETQ CR22   (POLAR p5    (+ AG1 AG2 )  G                      )      )
 (SETQ CR33   (POLAR p6     (+ AG1 AG2 )  G                      )      )
 (SETQ CR44   (POLAR p7     (+ AG1 AG2 )  PF                     )      )
 (SETQ CR55   (POLAR p8     (+ AG1 AG2 )  PF                     )      )
 (SETQ CR66   (POLAR p9     (+ AG1 AG2 )  T                      )      )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (SETQ PP1   (POLAR P1    (+ AG1 PI  )     1.0             )      )
 (SETQ PO    (POLAR P9       AG1           1.0             )      )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       (COMMAND "LAYER" "S" STOP2CNT  "")
 (COMMAND "LINE" dr1 dr2  "")
 (COMMAND "LINE" DR3  DR4  "")
 (COMMAND "LINE" DR44 DR33 "")
 (COMMAND "LINE" DR22 DR11    "")
;(COMMAND "LINE" dr33 dr3      "")
 (COMMAND "LINE" CR1 CR2 CR3 CR4 CR5 CR6 CR66 CR55 CR44 CR33 CR22 CR11    "")
 (COMMAND "LINE" CR4 CR44     "")
(COMMAND "LINE" CR5 CR55     "")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       (COMMAND "LAYER" "S" STOP2CEN  "")
(COMMAND "LINE" PO PP1       "")
(COMMAND "LAYER" "S" NLY "")
             )
