(DEFUN C:Q9o()
(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=Q9")
   (COMMAND "VSLIDE" "C:/ACAD/HON/B/Q9O")
 (SETQ DIM (GETREAL"\nPLEASE SLECT THE DIM OF THE ENTITY:(DIM1)" ))
 (IF (OR ( = DIM "" ) (= DIM NIL ) )
     (PROGN
     (SETQ DIM 1 )
 ))
 (IF (= DIM 1 )
    (PROGN
       ( SETQ P 1.5  )
       ( SETQ DD1 10 )
       ( SETQ D1 16.5 )
       ( SETQ H  6    )
       ( SETQ K 1.5  )
       ( SETQ S 20   )
       ( SETQ W 11  )
       ( SETQ H1 7    )
       ( SETQ D  30   )
       ))

 (IF (= DIM 2 )
    (PROGN
       ( SETQ P 1.75 )
       ( SETQ DD1 12 )
       ( SETQ D1 20   )
       ( SETQ H  9    )
       ( SETQ K 2    )
       ( SETQ S 22   )
       ( SETQ W 13  )
       ( SETQ H1 10   )
       ( SETQ D  38   )
       ))
(IF (= DIM 3 )
   (PROGN
      ( SETQ P 2    )
      ( SETQ DD1 16 )
      ( SETQ D1 25   )
      ( SETQ H  11   )
      ( SETQ K 2    )
      ( SETQ S 28   )
      ( SETQ W 18  )
      ( SETQ H1 12   )
      ( SETQ D  44   )
      ))
(IF (= DIM 4 )
   (PROGN
      ( SETQ P 2.5  )
      ( SETQ DD1 20 )
      ( SETQ D1 31   )
      ( SETQ H  13   )
      ( SETQ K 2.5  )
      ( SETQ S 32   )
      ( SETQ W 22  )
      ( SETQ H1 14   )
      ( SETQ D  50   )
      ))
(IF (= DIM 5 )
   (PROGN
      ( SETQ P 3    )
      ( SETQ DD1 24 )
      ( SETQ D1 36   )
      ( SETQ H 16    )
      ( SETQ K  3   )
      ( SETQ S 38   )
      ( SETQ W 26  )
      ( SETQ H1 17   )
      ( SETQ D  62   )
      ))
(IF (= DIM 6 )
   (PROGN
      ( SETQ P 3.5  )
      ( SETQ DD1 30 )
      ( SETQ D1 44   )
      ( SETQ H  20   )
      ( SETQ K 3.5  )
      ( SETQ S 42   )
      ( SETQ W 33  )
      ( SETQ H1 22   )
      ( SETQ D  72   )
      ))
(IF (= DIM 7 )
   (PROGN
      ( SETQ P 4    )
      ( SETQ DD1 36 )
      ( SETQ D1 52   )
      ( SETQ H  24   )
      ( SETQ K 4    )
      ( SETQ S 52   )
      ( SETQ W 39  )
      ( SETQ H1 26   )
      ( SETQ D  84   )
      ))
   (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 PLE (DISTANCE P1 P2  ))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (setq PLE1 (+ PLE ( * 1.5 DD1 )))
  (SETQ p3  (POLAR P1    AG1 (- H1 H ) ))
  (SETQ DR1 (POLAR P3 (- AG1 AG2 )  (+ (- D1 DD1 ) (/ DD1 2 ) )       ))
  (SETQ DR2 (POLAR DR1   AG1   H ))
  (SETQ DR3 (POLAR DR2 (+ AG1 AG2 ) (- D1 DD1 ) ))
  (SETQ DR5 (POLAR DR3  AG1 (- (- PLE1 H1 ) K ) ) )
  (SETQ DR4 (POLAR DR5 (+ AG1 PI ) (- S K )   ) )
  (SETQ MM  (POLAR P3    AG1   H ))
   (IF ( < (- PLE1 H1 ) S )
   (PROGN
   (SETQ DR5 (POLAR DR3  AG1 (- S K ) ) )
    (SETQ DR4  DR3  )
          ))
  (SETQ DR6 (POLAR DR4  (+ AG1 AG2 ) P  ) )
  (SETQ DR7 (POLAR DR6  AG1    S     ) )
  (SETQ DR11 (POLAR P3 (+ AG1 AG2 ) (+ (- D1 DD1 ) (/ DD1 2 ) ) ))
  (SETQ DR22 (POLAR DR11  AG1   H ))
  (SETQ DR33 (POLAR DR22 (- AG1 AG2 ) (- D1 DD1 ) ))
  (SETQ DR55 (POLAR DR33 AG1 ( - (- PLE1 H1 ) K ) ) )
  (SETQ DR44 (POLAR DR55 (+ AG1 PI ) (- S  K ) ) )
  (IF ( < (- PLE1 H1 ) S )
  (PROGN
  (SETQ DR55 (POLAR DR33 AG1 (-  S K ) ) )
   (SETQ DR44 DR33 )
         ))
  (SETQ DR66 (POLAR DR44  (- AG1 AG2 ) P  ) )
  (SETQ DR77 (POLAR DR66    AG1    S     ) )
   (COMMAND "LAYER" "S" STOP2cnt"")
  (command "LINE" DR7 DR77   "")
  (command "LINE" DR5 DR55 "")
  (command "LINE" DR4 DR44 "")
  (command "LINE" DR3 DR33   "")
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (SETQ K1 (POLAR P1 (- AG1 AG2 ) (/  D 2 ) ))
  (SETQ K2 (POLAR K1 AG1   H1 ))
  (SETQ K11  (POLAR P1  (+ AG1 AG2 ) (/ D 2 ) ))
  (SETQ K22  (POLAR K11    AG1   H1 ))
  (SETQ K3    (POLAR K2  (+ AG1 AG2 ) (/ (- D W ) 2.0 )  ))
  (SETQ K4    (POLAR P2  (- AG1 AG2 ) (/   W   2.0 )  ))
  (SETQ K33   (POLAR K22 (- AG1 AG2 ) (/ (- D W ) 2.0 )  ))
  (SETQ K44   (POLAR P2  (+ AG1 AG2 ) (/ W 2.0 )  ))
  (SETQ K5    (POLAR DR7  AG1 (* 0.5 DD1 )  ))
  (SETQ K6    (POLAR K5     AG1 ( * P 2 )    ))
  (SETQ K55   (POLAR DR77   AG1 ( * 0.5 DD1 )    ))
  (SETQ K66   (POLAR K55    AG1 ( * P 2 )    ))
  (SETQ K7    (POLAR K6   (+ AG1 (/ PI 3 ))     1        ))
  (SETQ K8    (POLAR K66  (- AG1 (/ PI 3  ) )     1        ))
  (SETQ K9    (INTERS K6 K7 K66 K8 NIL ))
  (SETQ G5    (POLAR DR5    AG1 (+ ( * 0.5 DD1 ) K )  ))
  (SETQ G55   (POLAR DR55   AG1 (+ ( * 0.5 DD1 ) K )  ))
  (SETQ G6    (POLAR K5     AG1    K         ))
  (SETQ G66   (POLAR K55    AG1    K         ))
   (COMMAND "LAYER" "S" STOP2cnt"")
 (command "LINE" P1 K1 K2 DR2"")
  (IF ( >= (- PLE1 H1 ) S )
  (PROGN
 (command "LINE" K3 K4  "")
 (command "LINE" K33 K44  "")
 ))
 (command "LINE" P1 K11 K22 DR22 "")
 (command "LINE" DR7 K5 K6 K66 K55 DR77 "")
 (command "LINE"K55  K5 "")
 (command "LINE"K66  K9 K6 "")
 (command "LINE"DR5  G5 G6 "")
 (command "LINE"DR55 G55 G66 "")
 (command "LINE"G5 G55  "")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(SETQ C3   (POLAR DR3  (+ AG1 PI  ) (- H 1 )))
(SETQ C2   (POLAR DR2  (+ AG1 PI  ) (- H 1 )))
(SETQ YX1   (POLAR P3   (- AG1 AG2 ) (+ (/ (- D1 DD1 ) 2.0 ) (/ DD1 2.0 ) )))
(SETQ YX2   (POLAR P3   (+ AG1 AG2 ) (+ (/ (- D1 DD1 ) 2.0 ) (/ DD1 2.0 ) )) )
(SETQ C33  (POLAR DR33 (+ AG1 PI  ) (- H 1 )))
(SETQ C22  (POLAR DR22 (+ AG1 PI  ) (- H 1 )))
(COMMAND "LAYER" "S" STOP2cnt"")
(COMMAND "ARC" C3 YX1 C2 )
(COMMAND "ARC" C22 YX2  C33  )
(COMMAND "ARC" C33 P3 C3    )
(COMMAND "LINE" C33   DR33  "")
(COMMAND "LINE" C3 DR3 "")
(command "LINE" P3 YX1 "")
(command "LINE" P3 YX2   "")
(COMMAND "LINE" C2 DR2 DR3 DR5 DR7 DR6 "")
(COMMAND "LINE" C22  DR22 DR33 DR55 DR77 DR66 "")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (COMMAND "LAYER" "S" STOP2CEN"")
 (SETQ PP8   (POLAR K9     AG1       1   ))
 (SETQ PP1   (POLAR P1  (+ AG1 PI  ) 1   ))
 (command "LINE" PP8 PP1 "")
   (COMMAND "LAYER" "S" NLY "")
             )
