(DEFUN C:D4O()
;(COMMAND "LAYER" "S" "0" "")
;(COMMAND "VSLIDE" "STOP2" )
(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 STOP2hid (GETSTRING T"\nSETTING STOP2 LAYER OF CONTNIUE LINE/<0>:"))
       (IF (= STOP2hid "")
              (WRITE-LINE "0" FC)
              (WRITE-LINE STOP2hid 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 STOP2hid (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 (= STOP2hid "") (= STOP2CEN "") (= STOP2HID "") (= STOP2DIM "") (= STOP2TXT "")
               (= STOP2hid NIL) (= STOP2CEN NIL) (= STOP2HID NIL) (= STOP2DIM NIL) (= STOP2TXT NIL))
           (CLOSE FC)
       )
(IF (OR (= STOP2hid "") (= STOP2CEN "") (= STOP2HID "") (= STOP2DIM "") (= STOP2TXT "")
               (= STOP2hid 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 STOP2hid (GETSTRING T"\nSETTING STOP2 LAYER OF CONTNIUE LINE/<0>:"))
              (IF (= STOP2hid "")
                  (WRITE-LINE "0" FC)
                  (WRITE-LINE STOP2hid 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 STOP2hid (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 STOP2hid)(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 STOP2hid)(PROMPT">:")
       (setq STOP2hid (GETSTRING T))
       (IF (= STOP2hid "")
              (WRITE-LINE "0" FC)
              (WRITE-LINE STOP2hid 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 STOP2hid (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 STOP2hid)(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/D4O")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(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 Q1 2.0  )
      ( SETQ Q2 1.5 )
     ( SETQ Q3 1.15 )
     ( SETQ Q4 1.4 )
      ( SETQ D1 2.84 )
     ( SETQ D2 2.5  )
     ( SETQ D3 5.0 )
                ))
     (IF (= DIM 2 )
   (PROGN
      ( SETQ A 6.0  )
      ( SETQ B 4.0  )
     ( SETQ C 2.5  )
      ( SETQ Q1 2.5  )
      ( SETQ Q2 1.75 )
     ( SETQ Q3 1.4  )
     ( SETQ Q4 1.65 )
      ( SETQ D1 4.25 )
     ( SETQ D2 3.0  )
     ( SETQ D3 5.0 )
                ))
     (IF (= DIM 3 )
   (PROGN
      ( SETQ A 6.0  )
      ( SETQ B 4.0  )
     ( SETQ C 3.0  )
      ( SETQ Q1 3.0  )
      ( SETQ Q2 2.0 )
     ( SETQ Q3 1.5 )
     ( SETQ Q4 1.9 )
      ( SETQ D1 5.67 )
     ( SETQ D2 3.0  )
     ( SETQ D3 7.0 )
                ))
     (IF (= DIM 4 )
   (PROGN
      ( SETQ A 8.0  )
      ( SETQ B 6.0  )
     ( SETQ C 4.0  )
      ( SETQ Q1 4.0  )
      ( SETQ Q2 2.5 )
     ( SETQ Q3 2.0  )
     ( SETQ Q4 2.4 )
      ( SETQ D1 4.12 )
     ( SETQ D2 4.0  )
     ( SETQ D3 7.0 )
     ))
     (IF (= DIM 5 )
   (PROGN
      ( SETQ A 8.0  )
      ( SETQ B 7.5  )
     ( SETQ C 5.0  )
      ( SETQ Q1 5.0  )
      ( SETQ Q2 3.1 )
     ( SETQ Q3 2.4  )
     ( SETQ Q4 2.9 )
      ( SETQ D1 5.22 )
     ( SETQ D2 5.0  )
     ( SETQ D3 7.0 )
                ))
     (IF (= DIM 6 )
   (PROGN
      ( SETQ A 8.0  )
      ( SETQ B 8.5  )
     ( SETQ C 6.0  )
      ( SETQ Q1 6.0  )
      ( SETQ Q2 4.1 )
     ( SETQ Q3 3.1  )
     ( SETQ Q4 3.6 )
      ( SETQ D1 5.22 )
     ( SETQ D2 5.0  )
     ( SETQ D3 7.0 )
                ))

   (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  ) ))
  (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 CR1   (POLAR P4 (- AG1 AG2 )    Q1         ) )
   (SETQ CR2   (POLAR P5  (- AG1 AG2 )   Q2               )      )
   (SETQ CR3   (POLAR P5   (- AG1 AG2 )  Q3           )      )
   (SETQ CR4   (POLAR P6   (- AG1 AG2 )  Q4                  )      )
   (SETQ CR11  (POLAR P4 (+ AG1 AG2 )    Q1         ) )
   (SETQ CR22  (POLAR P5  (+ AG1 AG2 )   Q2               )      )
   (SETQ CR33  (POLAR P5   (+ AG1 AG2 )  Q3           )      )
   (SETQ CR44  (POLAR P6   (+ AG1 AG2 )  Q4                  )      )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   (SETQ P8    (POLAR P7    AG1           1.0       ) )
   (SETQ P11   (POLAR P1  (- AG1 PI  )    1.0             )      )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       (COMMAND "LAYER" "S" STOP2CNT  "")
;(COMMAND "LINE" Dr1 dr2  DR3  DR4  "")
 (COMMAND "LINE" Dr1 dr2  "")
 (COMMAND "LINE" DR3  DR4  "")
;(COMMAND "LINE" DR44 DR33 DR22 DR11    "")
 (COMMAND "LINE" DR44 DR33 "")
 (COMMAND "LINE" DR22 DR11    "")
;(COMMAND "LINE" dr33 dr3      "")
 (COMMAND "LINE" Cr1 CR2 CR3 CR4 P7 CR44 CR33 CR22 CR11      "")
 (COMMAND "LINE" Cr33 Cr3      "")
 (COMMAND "LINE" Cr44 Cr4      "")
       (COMMAND "LAYER" "S" STOP2CEN  "")
 (COMMAND "LINE"  P8 P11       "")
(COMMAND "LAYER" "S" NLY "")
)
