;  *********************** UJ COMPUTER AUTO-DIM **************************
(VMON)
;(IF (= (TYPE F1) 'FILE ) "YES"  (STOP))
;(IF (= (TYPE F2) 'FILE ) "YES" (STOP))
(prompt "UJ ")
(DEFUN DIMJUDGEX ()
(IF (AND(>= (CAR P1)(CAR OP))(> (CAR EP)(CAR P1)))(SETQ SP(LIST(+ (CAR P1) BT)(CADR P1))))
(IF (AND(>= (CAR P1)(CAR OP))(< (CAR EP)(CAR P1)))(SETQ SP(LIST(- (CAR P1) BT)(CADR P1))))
(IF (AND(<= (CAR P1)(CAR OP))(> (CAR EP)(CAR P1)))(SETQ SP(LIST(+ (CAR P1) BT)(CADR P1))))
(IF (AND(<= (CAR P1)(CAR OP))(< (CAR EP)(CAR P1)))(SETQ SP(LIST(- (CAR P1) BT)(CADR P1))))
)
(DEFUN CIRDGV ()
(IF (AND(>= (CAR P1)(CAR OP))(> (CAR EP)(CAR P1)))(SETQ SP(LIST(+ (CAR P1) BT R 1)(CADR P1))))
(IF (AND(>= (CAR P1)(CAR OP))(< (CAR EP)(CAR P1)))(SETQ SP(LIST(- (CAR P1) BT R 1)(CADR P1))))
(IF (AND(<= (CAR P1)(CAR OP))(> (CAR EP)(CAR P1)))(SETQ SP(LIST(+ (CAR P1) BT R 1)(CADR P1))))
(IF (AND(<= (CAR P1)(CAR OP))(< (CAR EP)(CAR P1)))(SETQ SP(LIST(- (CAR P1) BT R 1)(CADR P1))))
)
;
(DEFUN DIMVER ()
(IF (AND(>= (CAR V1)(CAR OP))(> (CAR EP)(CAR V1)))(SETQ SP (LIST(+ (CAR V1) BT)(CADR V1))))
(IF (AND(>= (CAR V1)(CAR OP))(< (CAR EP)(CAR V1)))(SETQ SP (LIST(- (CAR V1) BT)(CADR V1))))
(IF (AND(<= (CAR V1)(CAR OP))(> (CAR EP)(CAR V1)))(SETQ SP (LIST(+ (CAR V1) BT)(CADR V1))))
(IF (AND(<= (CAR V1)(CAR OP))(< (CAR EP)(CAR V1)))(SETQ SP (LIST(- (CAR V1) BT)(CADR V1))))
)
;
(DEFUN DIMHER ()
(IF (AND(>= (CADR H1)(CADR OP))(> (CADR EP)(CADR H1)))(SETQ SP(LIST (CAR H1) (+ (CADR H1) BT))))
(IF (AND(>= (CADR H1)(CADR OP))(< (CADR EP)(CADR H1)))(SETQ SP(LIST (CAR H1) (- (CADR H1) BT))))
(IF (AND(<= (CADR H1)(CADR OP))(> (CADR EP)(CADR H1)))(SETQ SP(LIST (CAR H1) (+ (CADR H1) BT))))
(IF (AND(<= (CADR H1)(CADR OP))(< (CADR EP)(CADR H1)))(SETQ SP(LIST (CAR H1) (- (CADR H1) BT))))
)
;
(DEFUN DIMJUDGEY ()
(IF (AND(>= (CADR P1)(CADR OP))(> (CADR EP)(CADR P1)))(SETQ SP(LIST (CAR P1) (+ (CADR P1) BT))))
(IF (AND(>= (CADR P1)(CADR OP))(< (CADR EP)(CADR P1)))(SETQ SP(LIST (CAR P1) (- (CADR P1) BT))))
(IF (AND(<= (CADR P1)(CADR OP))(> (CADR EP)(CADR P1)))(SETQ SP(LIST (CAR P1) (+ (CADR P1) BT))))
(IF (AND(<= (CADR P1)(CADR OP))(< (CADR EP)(CADR P1)))(SETQ SP(LIST (CAR P1) (- (CADR P1) BT))))
)
;
(DEFUN CIRDGH ()
(IF (AND(>= (CADR P1)(CADR OP))(> (CADR EP)(CADR P1)))(SETQ SP(LIST (CAR P1) (+ (CADR P1) BT R 1))))
(IF (AND(>= (CADR P1)(CADR OP))(< (CADR EP)(CADR P1)))(SETQ SP(LIST (CAR P1) (- (CADR P1) BT R 1))))
(IF (AND(<= (CADR P1)(CADR OP))(> (CADR EP)(CADR P1)))(SETQ SP(LIST (CAR P1) (+ (CADR P1) BT R 1))))
(IF (AND(<= (CADR P1)(CADR OP))(< (CADR EP)(CADR P1)))(SETQ SP(LIST (CAR P1) (- (CADR P1) BT R 1))))
)
;
(DEFUN DIMJUDGEX1 ()
(IF (AND(>= (CAR P1)(CAR OP))(> (CAR EP)(CAR P1)))(SETQ SP (LIST (+ (CAR P1) BT) (CADR P1))))
(IF (AND(>= (CAR P1)(CAR OP))(< (CAR EP)(CAR P1)))(SETQ SP (LIST (- (CAR P1) BT) (CADR P1))))
(IF (AND(<= (CAR P1)(CAR OP))(> (CAR EP)(CAR P1)))(SETQ SP (LIST (+ (CAR P1) BT) (CADR P1))))
(IF (AND(<= (CAR P1)(CAR OP))(< (CAR EP)(CAR P1)))(SETQ SP (LIST (- (CAR P1) BT) (CADR P1))))
)
;
(DEFUN DIMJUDGEY1 ()
(IF (AND(>= (CADR P1)(CADR OP))(> (CADR EP)(CADR P1)))(SETQ SP (LIST (CAR P1) (+ (CADR P1) BT))))
(IF (AND(>= (CADR P1)(CADR OP))(< (CADR EP)(CADR P1)))(SETQ SP (LIST (CAR P1) (- (CADR P1) BT))))
(IF (AND(<= (CADR P1)(CADR OP))(> (CADR EP)(CADR P1)))(SETQ SP (LIST (CAR P1) (+ (CADR P1) BT))))
(IF (AND(<= (CADR P1)(CADR OP))(< (CADR EP)(CADR P1)))(SETQ SP (LIST (CAR P1) (- (CADR P1) BT))))
)
;
(DEFUN SCALD()
(SETQ URSCALD (GETVAR "USERR3"))
(PROMPT"\nLAST 1=1 SACLE IS <")(PRIN1 SCAL)(PROMPT">")
(PROMPT"\nLAST 1=X SACLE IS <")(PRIN1 URSCALD)(PROMPT">")
(IF (= (setq scal (getreal "\nPLEASE INPUT VALUE OF SCALE/<1>:")) NIL)
       (setq scal 1))

)
;*TO DEFUN ORIGIN POINT:
( defun ORIGIN ()
    (COMMAND "SETVAR" "CMDECHO" "0")
    (SETQ ANS (GETSTRING"\nSETTING ORGIN POINT (1) 1=1 SCALE (2) 1=X SELECT 1 OR 2 /<1>: "))
    (IF (OR (= ANS "1") (= ANS ""))
        (PROGN
           (SETQ OPX (GETVAR "USERR4"))
           (SETQ OPY (GETVAR "USERR5"))
           (PROMPT"\nLAST 1=1 SCALE'S ORGIN POINT IS:<")(PRIN1 OPX)(PROMPT",")(PRIN1 OPY)(PROMPT">")
           (PROMPT"\nCHOOSE ORIGIN POINT OR <ENTER> NO CHANGE:")(PROMPT"<")(PRIN1 OPX)(PROMPT",")(PRIN1 OPY)(PROMPT"> ")
           (setq op (getpoint))
           (IF (= OP NIL)
               (SETQ OP (LIST OPX OPY))
           )
           (IF (/= OP NIL)
               (PROGN
                 (COMMAND "SETVAR" "USERR4" (CAR OP))
                 (COMMAND "SETVAR" "USERR5" (CADR OP))
               )
           )
        )
    )
    (IF (= ANS "2")
        (PROGN
           (SETQ NOPX (GETVAR "USERR1"))
           (SETQ NOPY (GETVAR "USERR2"))
           (PROMPT"\nLAST 1=X SCALE'S ORGIN POINT IS:<")(PRIN1 NOPX)(PROMPT",")(PRIN1 NOPY)(PROMPT">")
           (PROMPT"\nCHOOSE ORIGIN POINT OR <ENTER> NO CHANGE:")(PROMPT"<")(PRIN1 NOPX)(PROMPT",")(PRIN1 NOPY)(PROMPT"> ")
           (setq op (getpoint))
           (IF (= OP NIL)
               (SETQ OP (LIST NOPX NOPY))
           )
        )
    )
    (setq o1 0)
    (setq o3 0)
    (setq L1 0)
    (setq L3 0)
)
;
;  -----------------------------------------------------------
;
(prompt "CO")
;  TO DEFUN DIM TEXT HEIGHT:
( defun TEXTH ()
        (IF (= (setq txt (getreal "\nDIM TEXT HEIGHT:/<3)")) NIL)
            (setq TXT 3.0))
)
;
;  -----------------------------------------------------------
;
;  TO CHOOSE NUMBER OF DIGITS
;
(prompt "MP")
( defun DIGIT ()
        (IF (= (setq a (getint "\nNUMBER OF DIGITS/<2>:")) NIL)
            (setq a 2))
)
;
;  -----------------------------------------------------------
;
(prompt "UT")
;  TO GET EXTENSION LINE POINT:
( defun EXTLI ()
        (setq ep (getpoint "\nPICK UP EXTENSION LINE POINT:"))
;       (setq epX1 (getpoint "\nFirst Corner:"))
;       (setq epY2 (getCORNER EPX1 "\nOrther Corner:"))
;       (setq epX2 (LIST (CAR EPY2) (CADR EPX1)))
;       (setq epY1 (LIST (CAR EPX1) (CADR EPX1)))
)
;
;  -----------------------------------------------------------
(prompt "ER  ")
;  TO GET EXTENSION LINE POINT:
;
( defun tang ()
        (IF (= (setq t1 (getreal "\nANGLE OF VALUE TO DIM:(EXMPLE 0=90ø,0.6=30ø,1=45ø,2=60ø) 0---2  <0.6>:")) NIL)
            (setq t1 0.6))
)
;
;------------------------------------------------------------------
;  -----------------------------------------------------------
;  DISTANCE BETWEEN EXTENSION LINE AND SELECT POINT
;
( defun BEET ()
        (IF (= (setq bt (getreal "\nDISTANCE BETWEEN EXTENSION LINE AND SELECT POINT <1.0>:")) NIL)
            (setq bt 1.0))
)
;
;------------------------------------------------------------------
;  -----------------------------------------------------------
;  DISTANCE BETWEEN EXTENSION LINE AND SELECT POINT
;
( defun ett ()
        (IF (= (setq TS (getreal "\nDISTANCE BETWEEN EXTENSION LINE AND TEXT <2.0>:")) NIL)
            (setq TS 2.0))
)
;
;------------------------------------------------------------------
;  -----------------------------------------------------------
;  SIN OVER AND UNDER
;
( defun SIN ()
        (IF (= (setq OVER (getstring "\nVALUE OF OVER <+0.5>:")) "")
            (setq OVER "+0.5"))
        (IF (= (setq UNDER (getstring "\nVALUE OF UNDER <-0.5>:")) "")
            (setq UNDER "-0.5"))
)
;
;------------------------------------------------------------------
;  -----------------------------------------------------------
;  DOUBLE OVER AND UNDER
;
( defun DUB ()
        (IF (= (setq DBOVER (getstring "\nVALUE OF OVER AND UNDER<ñ0.5>:")) "")
            (setq DBOVER "0.5"))
)
;
;------------------------------------------------------------------
;  OSNAP MODE
;
(defun OSPP ()
        (IF (= (setq OSP (getstring "\nOSNAP MODE<INT,ENDP,CEN,NODE>:")) "")
            (setq OSP "INT,ENDP,CEN,NODE"))
)
;
;------------------------------------------------------------------
;
(prompt "AU")
( DEFUN C:MDIMCONT ()
    (COMMAND "SETVAR" "CMDECHO" "0")
    (SETTING)
    (ORIGIN)
    (EXTLI)
;   (OSPP)
)
(prompt "TO") (princ)
;
;  -----------------------------------------------------------
;  -----------------------------------------------------------
;
;  TO DRAW VER-DIM AND CONT.
(defun C:DVER ()
        (COMMAND "LAYER" "SET" DIMLY "")
        (NULL v1)
        (setq v1 (OSNAP (getpoint "Slect a point:") OSP))
        (setq dis (RTOS (abs (- (cadr v1) (cadr op))) 2 A))
        (setq dis (RTOS (/ (atof dis ) scal) 2 A))
        (DIMVER)
        (setq enp1 (list (car ep) (cadr v1)))
        (command "line" sp enp1"")
        (COMMAND "LAYER" "S" DIMT "")
        (if (> (car ep) (car v1))
           (setq enp1 (list (+ (car enp1) TS) (- (cadr enp1) (/ txt 2))))
           (setq enp1 (list (- (car enp1) TS) (- (cadr enp1) (/ txt 2)))))
        (if (> (car ep) (car v1))
            (command "text" enp1 txt "0" dis)
            (command "text" "r" enp1 txt "0" dis))
;       (COMMAND "LAYER" "SET" DIMLY "")
;       (NULL v1)
;       (setq dis (RTOS (abs (- (cadr v1) (cadr op))) 2 A))
;       (setq dis (RTOS (/ (atof dis ) scal) 2 A))
;       (DIMVER)
;       (IF (> (CAR EP) (CAR OP))
;           (SETQ SP (LIST (+ (CAR V1) BT) (CADR V1)))
;           (SETQ SP (LIST (- (CAR V1) BT) (CADR V1)))
;       )
;       (if (> (car EP) (car OP))
;         (setq enp1 (list (car ep) (cadr v1)))
;         (setq enp1 (list (car ep) (cadr v1)))
;       )
;       (command "line" sp enp1"")
;       (COMMAND "LAYER" "S" DIMT "")
;       (if (> (car EP) (car OP))
;          (setq enp1 (list (+ (car enp1) TS) (- (cadr enp1) (/ txt 2))))
;          (setq enp1 (list (- (car enp1) TS) (- (cadr enp1) (/ txt 2)))))
;       (if (> (car EP) (car OP))
;           (command "text" enp1 txt "0" dis)
;           (command "text" "r" enp1 txt "0" dis))
        (C:DVER)
)
;
; --------------------------------------------------------
;  -----------------------------------------------------------
;
;  TO DRAW VER-DIM AND CONT.
(defun C:2PX ()
        (COMMAND "LAYER" "SET" DIMLY "")
        (NULL v1)
        (setq v1 (OSNAP (getpoint "Slect First point:") OSP))
;       (setq v1 (getpoint "Slect First point:"))
        (setq dis (RTOS (abs (- (cadr v1) (cadr op))) 2 A))
        (setq dis (RTOS (/ (atof dis ) scal) 2 A))
        (setq P2 (GETPOINT"\nSecect Second point:"))
        (IF (= (RTD (ANGLE V1 (LIST (CAR P2) (CADR V1)))) 0.0)
            (SETQ SP (LIST (+ (CAR V1) BT) (CADR V1)))
            (SETQ SP (LIST (- (CAR V1) BT) (CADR V1)))
        )
        (SETQ P2 (LIST (CAR P2) (CADR SP)))
        (command "line" sp P2 "")
        (COMMAND "LAYER" "S" DIMT "")
        (if (> (car P2) (car v1))
           (setq P2 (list (+ (car P2) TS) (- (cadr P2) (/ txt 2))))
           (setq P2 (list (- (car P2) TS) (- (cadr P2) (/ txt 2)))))
        (if (> (car P2) (car v1))
            (command "text" P2 txt "0" dis)
            (command "text" "r" P2 txt "0" dis))
        (C:2PX)
)
;
; --------------------------------------------------------
;  TO HERI-DIM 2PY
;
(defun C:2PY ()
        (COMMAND "LAYER" "SET" DIMLY "")
        (NULL H1)
;       (setq H1 (getpoint "Slect a point:"))
        (setq H1 (OSNAP (getpoint "Slect a point:") OSP))
        (setq dis (RTOS (abs (- (car h1) (car op))) 2 A))
        (setq dis (RTOS (/ (atof dis ) scal) 2 A))
        (setq P2 (GETPOINT"\nSecect Second point:"))
        (IF (= (RTD (ANGLE H1 (LIST (CAR H1) (CADR P2)))) 90.0)
            (SETQ SP (POLAR H1 (DTR 90) BT))
            (SETQ SP (POLAR H1 (DTR 90) (* BT -1)))
        )
        (setq P2 (list (car h1) (cadr P2)))
        (command "line" sp P2 "")
        (COMMAND "LAYER" "S" DIMT "")
        (if (> (cadr P2) (cadr h1))
            (setq P2 (list (+ (car P2) (/ txt 2)) (+ (cadr P2) TS)))
            (setq P2 (list (+ (car P2) (/ txt 2)) (- (cadr P2) TS))))
        (if (> (cadr P2) (cadr h1))
            (command "text" P2 txt "90" dis)
            (command "text" "r" P2 txt "90" dis))
        (C:2PY)
)
;
; --------------------------------------------------------
;  TO DRAW HERI-DIM AND CONT.
;
(defun C:HER ()
        (COMMAND "LAYER" "SET" DIMLY "")
        (NULL H1)
        (setq H1 (OSNAP (getpoint "Slect a point:") OSP))
        (setq dis (RTOS (abs (- (car h1) (car op))) 2 A))
        (setq dis (RTOS (/ (atof dis ) scal) 2 A))
        (DIMHER)
        (setq enp (list (car h1) (cadr ep)))
        (command "line" sp enp "")
        (if (> (cadr ep) (cadr h1))
            (setq enp (list (+ (car enp) (/ txt 2)) (+ (cadr enp) TS)))
            (setq enp (list (+ (car enp) (/ txt 2)) (- (cadr enp) TS))))
        (COMMAND "LAYER" "S" DIMT "")
        (if (> (cadr ep) (cadr h1))
            (command "text" enp txt "90" dis)
            (command "text" "r" enp txt "90" dis))
        (C:HER)
)
;
;  -----------------------------------------------------------
;  TO DRAW HER-DIM  FOR AUTOVER
(defun C:VERI ()
    (COMMAND "LAYER" "SET" DIMLY "")
    (NULL P1)
    (setq dis (RTOS (abs (- (cadr p1) (cadr op))) 2 A))
    (setq dis (RTOS (/ (atof dis ) scal) 2 A))
    (DIMJUDGEX)
    (setq enp1 (list (car ep) (cadr p1)))
    (command "line" sp enp1 "")
    (if (> (car ep) (car p1))
        (setq enp1 (list (+ (car enp1) TS) (- (cadr enp1) (/ txt 2))))
        (setq enp1 (list (- (car enp1) TS) (- (cadr enp1) (/ txt 2))))
    )
    (COMMAND "LAYER" "S" DIMT "")
    (if (> (car ep) (car p1)) (command "text" enp1 txt "0" dis)
        (command "text" "r" enp1 txt "0" dis))
)
;
; -----------------------------------------------------------------------------
;  -----------------------------------------------------------
;
;  TO DRAW VERI-DIM  FOR AUTOVER
;
(defun C:HERI ()
    (COMMAND "LAYER" "SET" DIMLY "")
    (NULL P1)
    (setq dis (RTOS (abs (- (car p1) (car op))) 2 A))
    (setq dis (RTOS (/ (atof dis ) scal) 2 A))
    (DIMJUDGEY)
    (setq enp (list (car p1) (cadr ep)))
    (command "line" sp enp "")
    (if (> (cadr ep) (cadr p1))
        (setq enp (list (+ (car enp) (/ txt 2)) (+ (cadr enp) TS)))
        (setq enp (list (+ (car enp) (/ txt 2)) (- (cadr enp) TS)))
    )
    (COMMAND "LAYER" "S" DIMT "")
    (if (> (cadr ep) (cadr p1)) (command "text" enp txt "90" dis)
                  (command "text" "r" enp txt "90" dis))
)
;
;  -----------------------------------------------------------
;  -----------------------------------------------------------
;
;  TO DRAW HER-DIM AND CONT AND + - 0.5
(defun SIVER ()
        (COMMAND "LAYER" "SET" DIMLY "")
        (NULL v1)
        (setq v1 (OSNAP (getpoint "Slect a point:") OSP))
        (setq dis (RTOS (abs (- (cadr v1) (cadr op))) 2 A))
        (setq dis (RTOS (/ (atof dis ) scal) 2 A))
        (DIMVER)
        (IF (> (CAR V1) (CAR OP))
             (setq enp1 (list (car ep) (cadr v1)))
             (setq enp1 (list (car ep) (cadr v1)))
        )
        (command "line" sp enp1"")
        (COMMAND "LAYER" "S" DIMT "")
        (setq NIS (abs (- (cadr v1) (cadr op))))
        (SETQ N 3)
        (IF ( AND (> NIS 10)  (< NIS 100))
            (SETQ N 4)
        )
        (IF ( AND (> NIS 100)  (< NIS 1000))
            (SETQ N 5)
        )
        (IF ( AND (> NIS 1000)  (< NIS 10000))
            (SETQ N 6)
        )
        (if (> (car V1) (car OP))
           (setq enp1 (list (+ (car ep) TS) (- (cadr enp1) (/ txt 2))))
           (setq enp1 (list (- (car ep) TS (* TXT 2)) (- (cadr enp1) (/ txt 2)))))
        (if (> (car V1) (car OP))
            (command "text" enp1 txt "0" dis)
            (command "text" "r" enp1 txt "0" dis))
        (setq txt1 (/ txt 2))
        (SETQ TXT2 (RTOS txt1 2 A))
        (setq enp2 (list (car ep) (cadr v1)))
        (setq enp3 (list (car ep) (cadr v1)))
        (if (> (car ep) (car v1))
           (setq enp2 (list (+ (car enp1) (* TXT N )) (+ (cadr enp1) txt 1 TXT1 1)))
           (setq enp2 (list (+ (car enp1) (* TXT 2 )) (+ (cadr enp1) txt 1 TXT1 1))))
        (if (> (car ep) (car v1))
           (setq enp3 (list (+ (car enp1) (* TXT N )) (+ (cadr enp1) TXT 1)))
           (setq enp3 (list (+ (car enp1) (* TXT 2 )) (+ (cadr enp1) TXT 1 ))))

        (if (> (car ep) (car v1))
            (command "text" enp2 txt2 "0" OVER)
            (command "text" "r" enp2 txt2 "0" OVER))
        (if (> (car ep) (car v1))
            (command "text" enp3 txt2 "0" UNDER)
            (command "text" "r" enp3 txt2 "0" UNDER))
        (SIVER)
)
;
; --------------------------------------------------------
;  -----------------------------------------------------------
;
;  TO DRAW sigle dim
(defun SIHER ()
       (COMMAND "LAYER" "SET" DIMLY "")
        (NULL H1)
;       (setq H1 (getpoint "Slect a point:"))
        (setq H1 (OSNAP (getpoint "Slect a point:") OSP))
        (setq dis (RTOS (abs (- (car h1) (car op))) 2 A))
        (setq dis (RTOS (/ (atof dis ) scal) 2 A))
        (DIMHER)
        (setq enp (list (car h1) (cadr ep)))
        (command "line" sp enp"")
        (COMMAND "LAYER" "S" DIMT "")
        (setq NIS (abs (- (car H1) (car op))))
        (SETQ N 3)
        (IF ( AND (> NIS 10)  (< NIS 100))
            (SETQ N 4)
        )
        (IF ( AND (> NIS 100)  (< NIS 1000))
            (SETQ N 5)
        )
        (IF ( AND (> NIS 1000)  (< NIS 10000))
            (SETQ N 6)
        )

        (if (> (cadr ep) (cadr h1))
            (setq enp (list (+ (car enp) (/ txt 2)) (+ (cadr enp) TS)))
            (setq enp (list (+ (car enp) (/ txt 2)) (- (cadr enp) TS (* TXT 1.7)))))
        (if (> (cadr ep) (cadr h1))
            (command "text" enp txt "90" dis)
            (command "text" "r" enp txt "90" dis))
        (setq txt1 (/ txt 2))
        (SETQ TXT2 (RTOS txt1 2 A))
        (setq enp2 (list (car h1) (cadr ep)))
        (setq enp3 (list (car h1) (cadr ep)))
        (if (> (cadr ep) (cadr h1))
           (setq enp2 (list (- (car enp) txt 1 TXT1 1) (+ (cadr enp) (* txt N)) ) )
           (setq enp2 (list (- (car enp) TXT 1 TXT1 1) (+ (cadr enp) (* txt 2)))))
        (if (> (cadr ep) (cadr h1))
           (setq enp3 (list (- (car enp) txt 1 ) (+ (cadr enp) (* txt N)) ) )
           (setq enp3 (list (- (car enp) TXT 1 ) (+ (cadr enp) (* txt 2)))))
        (if (> (cadr ep) (cadr h1))
            (command "text" enp2 txt2 "90" OVER)
            (command "text" "r" enp2 txt2 "90" OVER))
        (if (> (cadr ep) (cadr h1))
            (command "text" enp3 txt2 "90" UNDER)
            (command "text" "r" enp3 txt2 "90" UNDER))
        (SIHER)
)
;
; --------------------------------------------------------
;  -----------------------------------------------------------
;
;  TO DRAW HER-DIM AND CONT AND + - 0.5
(defun DUVER ()
        (COMMAND "LAYER" "SET" DIMLY "")
        (NULL v1)
        (setq V1 (OSNAP (getpoint "Slect a point:") OSP))
        (setq dis (RTOS (abs (- (cadr v1) (cadr op))) 2 A))
        (setq dis (RTOS (/ (atof dis ) scal) 2 A))
        (DIMVER)
        (setq enp1 (list (car ep) (cadr v1)))
        (command "line" sp enp1"")
        (COMMAND "LAYER" "S" DIMT "")
        (SETQ DBOVER1 (STRCAT "+" DBOVER))
        (SETQ MUS "-")
        (setq NIS (abs (- (cadr v1) (cadr op))))
        (SETQ N1 2.5)
        (IF (= (STRLEN DBOVER) 2)
            (SETQ N1 3.5)
            (SETQ N1 2.5)
        )
        (IF (= (STRLEN DBOVER) 4)
            (SETQ N1 4.5)
            (SETQ N1 2.5)
        )
        (SETQ N 3)
        (IF ( AND (> NIS 10)  (< NIS 100))
            (SETQ N 4)
        )
        (IF ( AND (> NIS 100)  (< NIS 1000))
            (SETQ N 5)
        )
        (IF ( AND (> NIS 1000)  (< NIS 10000))
            (SETQ N 6)
        )
        (if (> (car ep) (car v1))
           (setq enp1 (list (+ (car enp1) TS) (- (cadr enp1) (/ txt 2))))
           (setq enp1 (list (- (car enp1) TS (* TXT 1.5)) (- (cadr enp1) (/ txt 2)))))
        (if (> (car ep) (car v1))
            (command "text" enp1 txt "0" dis)
            (command "text" "r" enp1 txt "0" dis))
        (setq txt1 (/ txt 2.0))
        (SETQ TXT2 (RTOS txt1 2 A))
        (setq enp2 (list (car ep) (cadr v1)))
        (setq enp3 (list (car ep) (cadr v1)))
        (if (> (car ep) (car v1))
           (setq enp2 (list (+ (car enp1) (* TXT N )) (+ (cadr enp1) TXT 1.5)))
           (setq enp2 (list (+ (car enp1) (* TXT 1.5))(+ (cadr enp1) TXT 1.5))))
        (if (> (car ep) (car v1))
           (setq enp3 (list (+ (car enp1) (* TXT N )) (- (cadr enp2) (/ TXT1 2))))
           (setq enp3 (list (+ (car enp1) (/ TXT1 2)) (- (cadr enp2) (/ TXT1 2)))))
        (if (> (car ep) (car v1))
            (command "text" enp2 txt2 "0" DBOVER1)
            (command "text" "r" enp2 txt2 "0" DBOVER1))
        (if (> (car ep) (car v1))
            (command "text" enp3 txt2 "0" MUS)
            (command "text" "r" enp3 txt2 "0" MUS))
        (DUVER)
)
;
; --------------------------------------------------------
;  -----------------------------------------------------------
;
;  TO DRAW sigle dim
(defun DUHER ()
        (COMMAND "LAYER" "SET" DIMLY "")
        (NULL H1)
        (setq H1 (OSNAP (getpoint "Slect a point:") OSP))
        (setq dis (RTOS (abs (- (car h1) (car op))) 2 A))
        (setq dis (RTOS (/ (atof dis ) scal) 2 A))
        (DIMHER)
        (setq enp (list (car h1) (cadr ep)))
        (command "line" sp enp"")
        (COMMAND "LAYER" "S" DIMT "")
        (SETQ DBOVER1 (STRCAT "+" DBOVER))
        (SETQ MUS "-")
        (setq NIS (abs (- (car H1) (car op))))
        (SETQ N1 4)
        (IF (= (STRLEN DBOVER) 3)
            (SETQ N1 5)
            (SETQ N1 4)
        )
        (IF (= (STRLEN DBOVER) 4)
            (SETQ N1 6)
            (SETQ N1 4)
        )
        (SETQ N 3)
        (IF ( AND (> NIS 10)  (< NIS 100))
            (SETQ N 4)
        )
        (IF ( AND (> NIS 100)  (< NIS 1000))
            (SETQ N 5)
        )
        (IF ( AND (> NIS 1000)  (< NIS 10000))
            (SETQ N 6)
        )

        (if (> (cadr ep) (cadr h1))
            (setq enp (list (+ (car enp) (/ txt 2)) (+ (cadr enp) TS)))
            (setq enp (list (+ (car enp) (/ txt 2)) (- (cadr enp) TS (* TXT 2.2)))))
        (if (> (cadr ep) (cadr h1))
            (command "text" enp txt "90" dis)
            (command "text" "r" enp txt "90" dis))
        (setq txt1 (/ txt 2.0))
        (SETQ TXT2 (RTOS txt1 2 A))
        (setq enp2 (list (car h1) (cadr ep)))
        (setq enp3 (list (car h1) (cadr ep)))
        (if (> (cadr ep) (cadr h1))
           (setq enp2 (list (- (car enp) TXT) (+ (cadr enp) (* txt N)  TXT1 ) ) )
           (setq enp2 (list (- (car enp) TXT) (+ (cadr enp) (* txt1 N1) ))))
        (if (> (cadr ep) (cadr h1))
           (setq enp3 (list (+ (car enp2) (/ txt1 2)) (+ (cadr enp) (* txt N) TXT1 ) ) )
           (setq enp3 (list (+ (car enp2) (/ TXT1 2)) (+ (cadr enp) (* txt 0.75)   ))))
        (if (> (cadr ep) (cadr h1))
            (command "text" enp2 txt2 "90" DBOVER1)
            (command "text" "r" enp2 txt2 "90" DBOVER1))
        (if (> (cadr ep) (cadr h1))
            (command "text" enp3 txt2 "90" MUS)
            (command "text" "r" enp3 txt2 "90" MUS))
        (DUHER)
)
;
; --------------------------------------------------------
;------AUTOVER------
(DEFUN AUTOVER ()
(GRAPHSCR) (TERPRI)                                     ;GRAPHICS MODE
(COMMAND "SETVAR" "HIGHLIGHT" "1")
(COMMAND "SELECT" "AU" "\\")
(SETQ SA (SSGET "P" ))                ;select entity
(SETQ N (SSLENGTH SA))                      ;LIST HOW MANY SELECT
(SETQ I 0)                                 ;FIRST ENTITY
(REPEAT N
  (SETQ NA (ENTGET (SSNAME SA I)))                    ;GET ENTITY NAME
  (SETQ I (+ 1 I))
  (SETQ NB (ASSOC 0 NA))
  (IF (= "LINE" (CDR NB))
      (PROGN
          (SETQ NP1 (ASSOC 11 NA))  ;right
          (SETQ NP1 (CDR NP1))      ;right
          (SETQ NP2 (ASSOC 10 NA))  ;left
          (SETQ NP2 (CDR NP2))      ;left
          (SETQ N1 (CAR NP1))       ;right
          (SETQ N2 (CAR NP2))       ;left
          (SETQ M1 (ABS (-  N1 (CAR EP))))
          (SETQ M2 (ABS (-  N2 (CAR EP))))
          (IF (> M1 M2)
              (SETQ P1 NP2)
              (SETQ P1 NP1)
          ) ;IF
          (C:VERI)
      );PROGN
  )
  (IF (= "CIRCLE" (CDR NB))
      (PROGN
          (SETQ NP1 (ASSOC 40 NA))
          (SETQ NP1 (CDR NP1))
          (SETQ NP2 (ASSOC 10 NA))
          (SETQ NP2 (CDR NP2))
          (SETQ R NP1)
          (SETQ N2 (CAR NP2))
          (SETQ P1 NP2)
          (CIRVER)
       )
  )
  (IF (= "INSERT" (CDR NB))
      (PROGN
          (SETQ NP2 (ASSOC 10 NA))
          (SETQ NP2 (CDR NP2))
          (SETQ P1 NP2)
          (C:VERI)
       )
  )

; ) ;BIG IF
) ;REPEAT
 (AUTOVER)
) ;defun
;------AUTOHER------
(DEFUN AUTOHER ()
(COMMAND "LAYER" "SET" DIMLY "")
(GRAPHSCR)                                              ;GRAPHICS MODE
(COMMAND "SETVAR" "HIGHLIGHT" "1")
(COMMAND "SELECT" "AU" "\\")
(SETQ SA (SSGET "P" ))                ;select entity
(SETQ N (SSLENGTH SA))                      ;LIST HOW MANY SELECT
(SETQ I 0)                                 ;FIRST ENTITY
(REPEAT N
  (SETQ NA (ENTGET (SSNAME SA I)))                    ;GET ENTITY NAME
  (SETQ I (+ 1 I))
  (SETQ NB (ASSOC 0 NA))
  (IF (= "LINE" (CDR NB)) (PROGN
          (SETQ NP1 (ASSOC 11 NA))  ;right
          (SETQ NP1 (CDR NP1))      ;right
          (SETQ NP2 (ASSOC 10 NA))  ;left
          (SETQ NP2 (CDR NP2))      ;left
          (SETQ N1 (CADR NP1))       ;right
          (SETQ N2 (CADR NP2))       ;left
          (SETQ M1 (ABS (-  N1 (CADR EP))))
          (SETQ M2 (ABS (-  N2 (CADR EP))))
          (IF (> M1 M2 )
              (SETQ P1 NP2)
              (SETQ P1 NP1)
          ) ;IF
          (C:HERI)
          );PROGN
   )

  (IF (= "CIRCLE" (CDR NB))
      (PROGN
          (SETQ NP1 (ASSOC 40 NA))
          (SETQ NP1 (CDR NP1))
          (SETQ NP2 (ASSOC 10 NA))
          (SETQ NP2 (CDR NP2))
          (SETQ R NP1)
          (SETQ P1 NP2)
          (CIRHER)
       )
  )
  (IF (= "INSERT" (CDR NB))
      (PROGN
          (SETQ NP2 (ASSOC 10 NA))
          (SETQ NP2 (CDR NP2))
          (SETQ P1 NP2)
          (C:HERI)
       )
  )

 )  ;REPRET
   (AUTOHER)
)  ;DEFUN
;
;-----------------------------------------------------------------------
;------HALFTURV-----
;
;
(DEFUN HALFTURV ()
(COMMAND "LAYER" "SET" DIMLY "")
(GRAPHSCR) (TERPRI)                                     ;GRAPHICS MODE
(COMMAND "SETVAR" "HIGHLIGHT" "1")
(COMMAND "SELECT" "AU" "\\")
(SETQ SA (SSGET "P" ))                ;select entity
(SETQ N (SSLENGTH SA))                      ;LIST HOW MANY SELECT
(SETQ I 0)                                 ;FIRST ENTITY
(REPEAT N
  (SETQ NA (ENTGET (SSNAME SA I)))                    ;GET ENTITY NAME
  (SETQ I (+ 1 I))
  (SETQ NB (ASSOC 0 NA))
  (IF (= "LINE" (CDR NB)) (PROGN
          (SETQ NP1 (ASSOC 11 NA))  ;right
          (SETQ NP1 (CDR NP1))      ;right
          (SETQ NP2 (ASSOC 10 NA))  ;left
          (SETQ NP2 (CDR NP2))      ;left
          (SETQ N1 (CAR NP1))       ;right
          (SETQ N2 (CAR NP2))       ;left
          (SETQ M1 (ABS (-  N1 (CAR EP))))
          (SETQ M2 (ABS (-  N2 (CAR EP))))
          (IF (> M1 M2)
              (SETQ P1 NP2)
              (SETQ P1 NP1)
          ) ;IF
          (SETQ P3 "H")
          (HALFV)
          ) ;PROGN

  (IF (= "POINT" (CDR NB)) (PROGN
          (SETQ NP1 (ASSOC 10 NA))
          (SETQ NP1 (CDR NP1))
          (SETQ NX (CAR NP1))
          (SETQ P1 NP1)
          (SETQ P3 "H")
          (HALFV)
          ) ;PROGN
  ) ;IF


  ) ;BIG IF
 )  ;REPRET
 (HALFTURV)
)   ;DEFUN
; ----------------------------------------------------------------------------
;
;------HALFTURH-----
;
;
(DEFUN HALFTURH ()
(COMMAND "LAYER" "SET" DIMLY "")
(GRAPHSCR) (TERPRI)                                     ;GRAPHICS MODE
(COMMAND "SETVAR" "HIGHLIGHT" "1")
(COMMAND "SELECT" "AU" "\\")
(SETQ SA (SSGET "P" ))                ;select entity
(SETQ N (SSLENGTH SA))                      ;LIST HOW MANY SELECT
(SETQ I 0)                                 ;FIRST ENTITY
(REPEAT N
  (SETQ NA (ENTGET (SSNAME SA I)))                    ;GET ENTITY NAME
  (SETQ I (+ 1 I))
  (SETQ NB (ASSOC 0 NA))
  (IF (= "LINE" (CDR NB)) (PROGN
          (SETQ NP1 (ASSOC 11 NA))  ;right
          (SETQ NP1 (CDR NP1))      ;right
          (SETQ NP2 (ASSOC 10 NA))  ;left
          (SETQ NP2 (CDR NP2))      ;left
          (SETQ N1 (CADR NP1))       ;right
          (SETQ N2 (CADR NP2))       ;left
          (SETQ M1 (ABS (-  N1 (CADR EP))))
          (SETQ M2 (ABS (-  N2 (CADR EP))))

          (IF (> M1 M2 )
              (SETQ P1 NP2)
              (SETQ P1 NP1)
          ) ;IF
          (SETQ P3 "H")
          (HALFH)
          ) ;PROGN


  (IF (= "POINT" (CDR NB)) (PROGN
          (SETQ NP1 (ASSOC 10 NA))
          (SETQ NP1 (CDR NP1))
          (SETQ NX (CAR NP1))
          (SETQ P1 NP1)
          (SETQ P3 "H")
          (HALFV)
          ) ;PROGN
  ) ;IF
;
  ) ;BIG IF
 )  ;REPRET
 (HALFTURH)
)  ;DEFUN
;
;------------------------------------------------------------------------------
;TO DEFUN HALFV TURN FUNCTION
;
(defun HALFV ()
        (COMMAND "LAYER" "SET" DIMLY "")
        (setq dis (RTOS (abs (- (cadr p1) (cadr op))) 2 A))
        (setq dis (RTOS (/ (atof dis ) scal) 2 A))
        (DIMJUDGEX)
        (IF (= P3 "H")
            (setq p3 (getpoint "\nCHOOSE Another POINT TO TURN : ")))
        (setq enp (list (car ep) (cadr p3)))
        (setq t2 (car p3 ))
        (setq t5 (* t1  (abs (- (cadr sp) (cadr p3)) )))
        (setq ok (- t2 (car sp)))
        (IF (> ok 0 )
            (setq t3 (- t2 t5))
            (setq t3 (+ t2 t5)))
        (setq t4 (cadr sp))
        (setq p2 (list t3 t4))
        (command "line" sp  p2 p3 enp "")
        (COMMAND "LAYER" "S" DIMT "")
        (if (> (car ep) (car p1))
            (setq enp (list (+ (car enp) 2) (- (cadr enp) (/ txt 2))))
            (setq enp (list (- (car enp) 2) (- (cadr enp) (/ txt 2)))))
        (if (> (car ep) (car p1))
            (command "text" enp txt "0" dis)
            (command "text" "r" enp txt "0" dis))
)
;
;------------------------------------------------------------------------------
;TO DRAW HALF VERT-TURN DIM
;

(defun HALFH ()
      (COMMAND "LAYER" "SET" DIMLY "")
      (setq dis (RTOS (abs (- (car p1) (car op))) 2 A))
      (setq dis (RTOS (/ (atof dis ) scal) 2 A))
      (DIMJUDGEY)
      (IF (= P3 "H")
          (setq p3 (getpoint "\nCHOOSE Another POINT TO TURN : ")))
      (setq enp (list (car p3) (cadr ep)))
      (setq t2 (cadr p3 ))
      (setq t5 (* t1  (abs (- (car sp) (car p3)) )))
      (setq ok (- t2 (cadr sp)))
      (IF (> ok 0 )
          (setq t3 (- t2 t5))
          (setq t3 (+ t2 t5)))
      (setq t4 (car sp))
      (setq p2 (list t4 t3))
      (command "line" sp p2 p3 enp "")
      (COMMAND "LAYER" "S" DIMT "")
      (if (> (cadr ep) (cadr p1))
          (setq enp (list (+ (car enp) (/ txt 2)) (+ (cadr enp) 2)))
          (setq enp (list (+ (car enp) (/ txt 2)) (- (cadr enp) 2))))
      (if (> (cadr ep) (cadr p1))
          (command "text" enp txt "90" dis)
          (command "text" "r" enp txt "90" dis))
)
;
; -----------------------------------------------------------------------------
;------AUTOTURV-----
(DEFUN AUTOTURV ()
    (COMMAND "LAYER" "SET" DIMLY "")
    (GRAPHSCR)
    (TERPRI)                                     ;GRAPHICS MODE
    (SETQ O2 0)
    (setq hc 0)
    (COMMAND "SETVAR" "HIGHLIGHT" "1")
    (COMMAND "SELECT" "AU" "\\")
    (SETQ Z2 NIL)
    (setq Z2 (getPOINT "\nPlease Slect Turn point:"))
    (SETQ SA (SSGET "P" ))                ;select entity
    (SETQ N (SSLENGTH SA))                      ;LIST HOW MANY SELECT
    (SETQ I 0)                                 ;FIRST ENTITY
    (SETQ JJ 0)
    (SETQ F (OPEN "AUTODIM.DAT" "w"))
    (REPEAT N
       (SETQ NA (ENTGET (SSNAME SA I)))                    ;GET ENTITY NAME
       (SETQ I (+ 1 I))
       (SETQ NB (ASSOC 0 NA))
       (IF (= "LINE" (CDR NB))
           (PROGN
               (SETQ NP1 (ASSOC 10 NA))
               (SETQ NP1 (CDR NP1))
               (SETQ NX1 (ABS (- (CAR NP1) (CAR EP))))
               (SETQ NP2 (ASSOC 11 NA))
               (SETQ NP2 (CDR NP2))
               (SETQ NX2 (ABS (- (CAR NP2) (CAR EP))))
               (IF (> NX2 NX1) (SETQ P1 NP1) (SETQ P1 NP2))
               (SETQ NX (CAR P1))
               (IF (OR (> (CAR EP) (CAR OP)) (>= NX (CAR OP)))
                   (PROGN
                       (SETQ P1X (RTOS (CAR P1) 2))
                       (SETQ P1Y (RTOS (CADR P1) 2))
                       (SETQ P (STRCAT P1X "," P1Y))
                       (SETQ JJ (+ JJ 1))
                       (SETQ TEST "A")
                       (WRITE-LINE P F)
                   )
               )
               (IF (OR (< (CAR EP) (CAR OP)) (<= NX (CAR OP)))
                   (PROGN
                       (SETQ P1X (RTOS (CAR P1) A))
                       (SETQ P1Y (RTOS (CADR P1) A))
                       (SETQ P (STRCAT P1X "," P1Y))
                       (SETQ JJ (+ JJ 1))
                       (WRITE-LINE P F)
                   )
               )
           )
       )

       (IF (= "CIRCLE" (CDR NB))
           (PROGN
             (SETQ NP1 (ASSOC 40 NA))
             (SETQ NP1 (CDR NP1))
             (SETQ NP2 (ASSOC 10 NA))
             (SETQ NP2 (CDR NP2))
             (SETQ R NP1)
             (SETQ P1 NP2)
             (SETQ P1Y (RTOS (CADR P1) A))
             (IF (< (CAR OP) (CAR EP))
                 (SETQ P1X (RTOS (+ (CAR P1) R 1) A))
             )
             (IF (> (CAR OP) (CAR EP))
                 (SETQ P1X (RTOS (- (CAR P1) R 1) A))
             )
             (SETQ P (STRCAT P1X "," P1Y))
             (SETQ JJ (+ JJ 1))
             (WRITE-LINE P F)
          )
       )

       (IF (= "INSERT" (CDR NB))
           (PROGN
             (SETQ NP2 (ASSOC 10 NA))
             (SETQ NP2 (CDR NP2))
             (SETQ P1 NP2)
             (SETQ P1Y (RTOS (CADR P1) A))
             (IF (< (CAR OP) (CAR EP))
                 (SETQ P1X (RTOS (CAR P1) A))
             )
             (IF (> (CAR OP) (CAR EP))
                 (SETQ P1X (RTOS (CAR P1) A))
             )
             (SETQ P (STRCAT P1X "," P1Y))
             (SETQ JJ (+ JJ 1))
             (WRITE-LINE P F)
          )
       )

    );REPEAT
    (WRITE-CHAR 1 F)
    (CLOSE F)


    (COMMAND "AUTODIM" "")
    (GRAPHSCR)
    (SETQ F (OPEN "AUTODIM.DAT" "r"))
    (SETQ P (READ-LINE F))
    (SETQ P (ATOF P))
    (SETQ PG (READ-LINE F))
    (SETQ PG (ATOF PG))
    (SETQ Q1 (LIST P PG))
    (SETQ P1 Q1)
    (turnv)
;
    (REPEAT  (- JJ 1)
        (SETQ P (READ-LINE F))
        (SETQ P (ATOF P))
        (SETQ PG (READ-LINE F))
        (SETQ PG (ATOF PG))
        (SETQ Q2 (LIST P PG))
        (IF (= (CADR Q1) (CADR Q2))
            (SETQ Q1 Q2)
            (PROGN
                (SETQ P (- (CADR Q2) (CADR Q1)))
                (IF (< P (+ TXT 1))
                    (PROGN
                      (IF (> (CAR EP) (CAR OP))
                        (SETQ Q3 (LIST (- (CAR EP) 5) (+ (/ TXT 2) (CADR Q2))))
                        (SETQ Q3 (LIST (+ (CAR EP) 5) (+ (/ TXT 2) (CADR Q2)))))
                      (SETQ P1 Q2)
                      (TURNV)
                    )
                    (PROGN
                      (SETQ P1 Q2)
                      (turnv)
                    ))
                (SETQ Q1 Q2)
            )
        )
    )
;   (SETQ O1 0)
;   (SETQ O2 0)
    (SETQ O3 0)
)
;  -----------------------------------------------------------
; -----------------------------------------------------------------------------
;------AUTOTURH-----
(DEFUN AUTOTURH ()
    (COMMAND "LAYER" "SET" DIMLY "")
    (GRAPHSCR)
    (TERPRI)                                     ;GRAPHICS MODE
    (SETQ L2 0)
    (COMMAND "SETVAR" "HIGHLIGHT" "1")
    (COMMAND "SELECT" "AU" "\\")
    (SETQ k2 NIL)
    (setq K2 (getPOINT "\nPlease Slect Turn point:"))
    (SETQ SA (SSGET "P" ))                ;select entity
    (SETQ N (SSLENGTH SA))                      ;LIST HOW MANY SELECT
    (SETQ I 0)                                 ;FIRST ENTITY
    (SETQ JJ 0)
    (SETQ F (OPEN "AUTODIM.DAT" "w"))
    (REPEAT  N
       (SETQ NA (ENTGET (SSNAME SA I)))                    ;GET ENTITY NAME
       (SETQ I (+ 1 I))
       (SETQ NB (ASSOC 0 NA))
       (IF (= "LINE" (CDR NB))
           (PROGN
               (SETQ NP1 (ASSOC 10 NA))
               (SETQ NP1 (CDR NP1))
               (SETQ NX1 (ABS (- (CADR NP1) (CADR EP))))
               (SETQ NP2 (ASSOC 11 NA))
               (SETQ NP2 (CDR NP2))
               (SETQ NX2 (ABS (- (CADR NP2) (CADR EP))))
               (IF (> NX2 NX1) (SETQ P1 NP1) (SETQ P1 NP2))
               (SETQ NX (CADR P1))
               (IF (OR (> (CADR EP) (CADR OP)) (>= NX (CADR OP)))
                   (PROGN
                       (SETQ P1X (RTOS (CAR P1) A))
                       (SETQ P1Y (RTOS (CADR P1) A))
                       (SETQ P (STRCAT P1X "," P1Y))
                       (SETQ JJ (+ JJ 1))
                       (WRITE-LINE P F)
                   )
               )
               (IF (OR (< (CADR EP) (CADR OP)) (<= NX (CADR OP)))
                   (PROGN
                       (SETQ P1X (RTOS (CAR P1) A))
                       (SETQ P1Y (RTOS (CADR P1) A))
                       (SETQ P (STRCAT P1X "," P1Y))
                       (SETQ JJ (+ JJ 1))
                       (WRITE-LINE P F)
                   )
               )
           )
       )


       (IF (= "CIRCLE" (CDR NB))
           (PROGN
             (SETQ NP1 (ASSOC 40 NA))
             (SETQ NP1 (CDR NP1))
             (SETQ NP2 (ASSOC 10 NA))
             (SETQ NP2 (CDR NP2))
             (SETQ R NP1)
             (SETQ P1 NP2)
             (SETQ P1X (RTOS (CAR P1) A))
             (IF (< (CADR OP) (CADR EP))
                 (SETQ P1Y (RTOS (+ (CADR P1) R 1) A))
             )
             (IF (> (CADR OP) (CADR EP))
                 (SETQ P1Y (RTOS (- (CADR P1) R 1) A))
             )
             (SETQ P (STRCAT P1X "," P1Y))
             (SETQ JJ (+ JJ 1))
             (WRITE-LINE P F)
          )
       )

       (IF (= "INSERT" (CDR NB))
           (PROGN
             (SETQ NP2 (ASSOC 10 NA))
             (SETQ NP2 (CDR NP2))
             (SETQ P1 NP2)
             (SETQ P1X (RTOS (CAR P1) A))
             (IF (< (CADR OP) (CADR EP))
                 (SETQ P1Y (RTOS (CADR P1) A))
             )
             (IF (> (CADR OP) (CADR EP))
                 (SETQ P1Y (RTOS (CADR P1) A))
             )
             (SETQ P (STRCAT P1X "," P1Y))
             (SETQ JJ (+ JJ 1))
             (WRITE-LINE P F)
          )
       )





    );REPEAT
    (WRITE-CHAR 2 F)
    (CLOSE F)
    (COMMAND "AUTODIM" "")
    (GRAPHSCR)
    (SETQ F (OPEN "AUTODIM.DAT" "r"))
    (SETQ P (READ-LINE F))
    (SETQ P (ATOF P))
    (SETQ PG (READ-LINE F))
    (SETQ PG (ATOF PG))
    (SETQ Q1 (LIST P PG))
    (SETQ P1 Q1)
    (SETQ L3 (- (CAR P1) 10))
    (TURNH)
;
    (REPEAT (- JJ 1)
        (SETQ P (READ-LINE F))
        (SETQ P (ATOF P))
        (SETQ PG (READ-LINE F))
        (SETQ PG (ATOF PG))
        (SETQ Q2 (LIST P PG))
        (IF (= (CAR Q1) (CAR Q2))
            (SETQ Q1 Q2)
            (PROGN
                (SETQ P (- (CAR Q2) (CAR Q1)))
                (IF (< P (+ TXT 1))
                    (PROGN
                      (IF (> (CAR EP) (CAR OP))
                        (SETQ Q3 (LIST (- (CAR EP) 5) (+ (/ TXT 2) (CADR Q2))))
                        (SETQ Q3 (LIST (+ (CAR EP) 5) (+ (/ TXT 2) (CADR Q2)))))
                      (SETQ P1 Q2)
                      (TURNH)
                    )
                    (PROGN
                      (SETQ P1 Q2)
                      (TURNH)
                    ))
                (SETQ Q1 Q2)
            )
        )
    )

    (SETQ l3 0)
)
;  -----------------------------------------------------------
;
(prompt "DIM  ")
;
;TO DEFUN TURNV  FUNCTION
;
(defun TURNV()
   (SETQ TZ (GETVAR "TEXTSIZE"))
   (COMMAND "LAYER" "SET" DIMLY "")
   ;======== MM TURN LINE ======
   (IF (> TZ 1)
     (PROGN
       (setq dis (RTOS (abs (- (cadr p1) (cadr op))) 2 A))
       (setq dis (RTOS (/ (atof dis ) scal) 2 A))
       (DIMJUDGEX)
       (SETQ P2X (CAR Z2 ))
       (setq P2Y (cadr sp))
       (setq p2 (list p2x p2y))
       (setq p3y (cadr p1))
       (setq hc (+ hc 1)) ;HC=1

       (if (> (car p1) (car OP))
           (setq p3X (+ (car z2) (abs (/ (- (car ep) (car z2)) 2.3))))
           (setq p3X (- (car p2) (abs (/ (- (car ep) (car p2)) 2.3))))
       )
       (if (and (>= (abs (- (cadr p1) o1 )) (+ txt 1)) (> p3y o3) (< (- p3y o3) (+ txt 1) ) )
            (setq p3y (+ o3 txt 1))
            (SETQ P3Y (cadr p2))
       )
       (if (and (>= (abs (- (cadr p1) o1 )) (+ txt 1)) (> (- p3y o3) (+ txt 1) ))
           (setq p3y (+ o3 txt 1))
           (SETQ P3Y (cadr p2))
       )
       (if (<= (abs (- (cadr p1) o1 )) (+ txt 1))
           (SETQ P3Y ( + o3 TXT 1 ) )
           (if (< p3y (+ o3 txt))
               (setq p3y (+ o3 txt 1))
               (SETQ P3Y (cadr p2))
           )
       )

       (if (= hc 1)
           (progn
             (setq p3y (cadr p1))
           )
       )
       (SETQ P3 (LIST p3x p3y))
       (IF (> (CAR Z2) (CAR OP))
           (setq enp (list (car ep) (cadr p3)))
           (setq enp (list (car ep) (cadr p3)))
       )
       (command "Pline" sp p2 p3 enp "")
       (COMMAND "LAYER" "S" DIMT "")
       (if (> (car Z2) (car OP))
           (setq enp (list (+ (car eP) TS) (- (cadr enp) (/ txt 2))))
           (setq enp (list (- (car eP) TS) (- (cadr enp) (/ txt 2))))
       )
       (if (> (car Z2) (car OP))
           (command "text" enp txt "0" dis)
           (command "text" "r" enp txt "0" dis)
       )
       (setq O1 (cadr p1))  ;old p1y
       (setq O3 (cadr p3))  ;old p3y
       (setq o2 (+ (car z2) (abs (/ (- (car ep) (car p2)) 2.3))))
    )
  )
   ;======== INCH TURN LINE ======
   (IF (< TZ 1)
     (PROGN
       (setq dis (RTOS (abs (- (cadr p1) (cadr op))) 2 A))
       (setq dis (RTOS (/ (atof dis ) scal) 2 A))
       (DIMJUDGEX)
       (SETQ P2X (CAR Z2 ))
       (setq P2Y (cadr sp))
       (setq p2 (list p2x p2y))
       (setq p3y (cadr p1))
       (setq hc (+ hc 0.0393))

       (if (> (car p1) (car OP))
           (setq p3X (+ (car z2) (abs (/ (- (car ep) (car z2)) 2.3))))
           (setq p3X (- (car p2) (abs (/ (- (car ep) (car p2)) 2.3))))
       )
       (if (and (>= (abs (- (cadr p1) o1 )) (+ txt 0.0393)) (> p3y o3) (< (- p3y o3) (+ txt 0.0393) ) )
            (setq p3y (+ o3 txt 0.0393))
            (SETQ P3Y (cadr p2))
       )
       (if (and (>= (abs (- (cadr p1) o1 )) (+ txt 0.0393)) (> (- p3y o3) (+ txt 0.0393) ))
           (setq p3y (+ o3 txt 0.0393))
           (SETQ P3Y (cadr p2))
       )
       (if (<= (abs (- (cadr p1) o1 )) (+ txt 0.0393))
           (SETQ P3Y ( + o3 TXT 0.0393 ) )
           (if (< p3y (+ o3 txt))
               (setq p3y (+ o3 txt 0.0393))  ;if<
               (SETQ P3Y (cadr p2))
           )
       )

       (if (= hc 0.0393)
           (progn
             (setq p3y (cadr p1))
           )
       )
       (SETQ P3 (LIST p3x p3y))
       (IF (> (CAR Z2) (CAR OP))
           (setq enp (list (car ep) (cadr p3)))
           (setq enp (list (car ep) (cadr p3)))
       )
       (command "Pline" sp  p2 p3 enp "")
       (COMMAND "LAYER" "S" DIMT "")
       (if (> (car Z2) (car OP))
           (setq enp (list (+ (car eP) TS) (- (cadr enp) (/ txt 2))))
           (setq enp (list (- (car eP) TS) (- (cadr enp) (/ txt 2))))
       )
       (if (> (car Z2) (car OP))
           (command "text" enp txt "0" dis)
           (command "text" "r" enp txt "0" dis)
       )
       (setq O1 (cadr p1))  ;old p1y
       (setq O3 (cadr p3))  ;old p3y
       (setq o2 (+ (car z2) (abs (/ (- (car ep) (car p2)) 0.090))))
    )
  )
)
;  -----------------------------------------------------------
;  -----------------------------------------------------------
(defun TURNH()
   (SETQ TZ (GETVAR "TEXTSIZE"))
   (COMMAND "LAYER" "SET" DIMLY "")
   ;======== MM TURN LINE ======
   (IF (> TZ 1)
      (PROGN
        (setq dis (RTOS (abs (- (car p1) (car op))) 2 A))
        (setq dis (RTOS (/ (atof dis ) scal) 2 A))
        (DIMJUDGEY)
        (SETQ P2X (CAR  SP))
        (setq P2Y (cadr k2))
        (setq p2 (list p2x p2y))
        (setq p3x (car SP))
        (if (< (cadr p1) (cadr ep))
            (setq p3y (+ (cadr k2) (abs (/ (- (cadr ep) (cadr k2)) 2.3))))
            (setq p3y (- (cadr K2) (abs (/ (- (cadr ep) (cadr p2)) 2.3)))))

        (if (< (- P3X L3 ) (+ txt 1))
               (setq p3x (+ L3 txt 1))
               (SETQ P3X (car SP))
        )

        (SETQ P3 (LIST p3x p3y))
        (setq enp (list (car p3) (cadr ep) ))
        (command "Pline" sp  p2 p3 enp "")
        (COMMAND "LAYER" "SET" DIMT "")
        (if (> (cadr ep) (cadr p1))
          (setq enp (list (+ (car enp) (/ txt 2)) (+ (cadr enp) TS)))
          (setq enp (list (+ (car enp) (/ txt 2)) (- (cadr enp) TS))))
        (if (> (cadr ep) (cadr p1))
          (command "text" enp txt "90" dis)
          (command "text" "r" enp txt "90" dis))
        (setq L1 (car p1))  ;old p1x
        (setq L3 (car p3))  ;old p3x
        (setq L2 (+ (cadr K2) (abs (/ (- (cadr ep) (cadr p2)) 2.3)) ) )
     )
  )
   ;======== INCH TURN LINE ======
   (IF (< TZ 1)
      (PROGN
        (setq dis (RTOS (abs (- (car p1) (car op))) 2 A))
        (setq dis (RTOS (/ (atof dis ) scal) 2 A))
        (DIMJUDGEY)
        (SETQ P2X (CAR  SP))
        (setq P2Y (cadr k2))
        (setq p2 (list p2x p2y))
        (setq p3x (car SP))
        (if (< (cadr p1) (cadr ep))
            (setq p3y (+ (cadr k2) (abs (/ (- (cadr ep) (cadr k2)) 2.3))))
            (setq p3y (- (cadr K2) (abs (/ (- (cadr ep) (cadr p2)) 2.3)))))

        (if (< (- P3X L3 ) (+ txt 0.0393))
               (setq p3x (+ L3 txt 0.0393))
               (SETQ P3X (car SP))
        )

        (SETQ P3 (LIST p3x p3y))
        (setq enp (list (car p3) (cadr ep) ))
        (command "Pline" sp  p2 p3 enp "")
        (if (> (cadr ep) (cadr p1))
          (setq enp (list (+ (car enp) (/ txt 2)) (+ (cadr enp) TS)))
          (setq enp (list (+ (car enp) (/ txt 2)) (- (cadr enp) TS))))
        (if (> (cadr ep) (cadr p1))
          (command "text" enp txt "90" dis)
          (command "text" "r" enp txt "90" dis))
        (setq L1 (car p1))  ;old p1x
        (setq L3 (car p3))  ;old p3x
        (setq L2 (+ (cadr K2) (abs (/ (- (cadr ep) (cadr p2)) 2.3)) ) )
     )
  )
)
;
;  -----------------------------------------------------------
;TO DEFUN TURN FUNCTION
(defun C:urnV()
      (COMMAND "LAYER" "SET" DIMLY "")
      (NULL P1)
;     (setq p1 (getpoint "\nWHICH POINT TO DIM:"))
      (setq P1 (OSNAP (getpoint "Slect a point:") OSP))
      (setq dis (RTOS (abs (- (cadr p1) (cadr op))) 2 A))
      (setq dis (RTOS (/ (atof dis ) scal) 2 A))
      (DIMJUDGEX1)
      (setq p3 (getpoint "\nCHOOSE Another POINT TO TURN : "))
      (setq enp (list (car ep) (cadr p3)))
      (setq t2 (car p3 ))
      (setq t5 (* t1  (abs (- (cadr sp) (cadr p3)) )))
      (setq ok (- t2 (car sp)))
      (IF (> ok 0 )
          (setq t3 (- t2 t5))
          (setq t3 (+ t2 t5))
      )
      (setq t4 (cadr sp))
      (setq p2 (list t3 t4))
      (command "line" sp  p2 p3 enp "")
      (COMMAND "LAYER" "S" DIMT "")
      (IF (AND (> (CAR EP) (CAR OP)) (> (CAR EP) (CAR P1)))
           (setq enp (list (+ (CAR EP) TS) (- (CADR P3) (/ txt 2))))
           (setq enp (list (- (car EP) TS) (- (cadr P3) (/ txt 2))))
       )
      (IF (AND (> (CAR EP) (CAR OP)) (> (CAR EP) (CAR P1)))
         (command "text" enp txt "0" dis)
         (command "text" "r" enp txt "0" dis)
     )
 (C:URNV)
)
;----------------------------------------------
;TO DRAW VERT-TURN DIM
(prompt "..")
(defun C:urnI ()
      (COMMAND "LAYER" "SET" DIMLY "")
      (NULL P1)
;     (setq p1 (getpoint "\nWHICH POINT TO DIM:"))
      (setq P1 (OSNAP (getpoint "Slect a point:") OSP))
      (setq dis (RTOS (abs (- (car p1) (car op))) 2 A))
      (setq dis (RTOS (/ (atof dis ) scal) 2 A))
      (DIMJUDGEY1)
      (setq p3 (getpoint "\nCHOOSE Another POINT TO TURN : "))
      (setq enp (list (car p3) (cadr ep)))
      (setq t2 (cadr p3 ))
      (setq t5 (* t1  (abs (- (car sp) (car p3)) )))
      (setq ok (- t2 (cadr sp)))
      (IF (> ok 0 )
          (setq t3 (- t2 t5))
          (setq t3 (+ t2 t5))
      )
      (setq t4 (car sp))
      (setq p2 (list t4 t3))
      (command "line" sp p2 p3 enp "")
      (COMMAND "LAYER" "S" DIMT "")
      (if (> (cadr ep) (cadr p1))
          (setq enp (list (+ (car enp) (/ txt 2)) (+ (cadr eP) TS)))
          (setq enp (list (+ (car enp) (/ txt 2)) (- (cadr eP) TS)))
      )
     (if (> (cadr ep) (cadr p1))
         (command "text" enp txt "90" dis)
         (command "text" "r" enp txt "90" dis)
     )
    (C:URNI)
)
;  -----------------------------------------------------------
;TO DEFUN TURN FUNCTION
(defun C:T3PX()
      (COMMAND "LAYER" "SET" DIMLY "")
      (COMMAND "ORTHO" "OFF")
;     (setq p1 (getpoint "\nFirst Point:"))
      (setq P1 (OSNAP (getpoint "Fisrt point:") OSP))
      (NULL P1)
      (setq dis (RTOS (abs (- (cadr p1) (cadr op))) 2 A))
      (setq dis (RTOS (/ (atof dis ) scal) 2 A))
      (COMMAND "ORTHO" "OFF")
      (setq p2 (getpoint P1 "\nSecond Point:"))
      (COMMAND "ORTHO" "ON")
      (setq p3 (getpoint P2 "\nThird Point:"))
      (SETQ ENP P3)
      (IF (= (DTR (ANGLE P1 (LIST (CAR P2) (CADR P1)))) 0.0)
          (SETQ SP (POLAR P1 (DTR (ANGLE SP P2)) BT))
          (SETQ SP (POLAR P1 (DTR (ANGLE SP P2)) (* BT -1)))
      )
      (command "line" sp  p2 enp "")
      (COMMAND "LAYER" "S" DIMT "")
      (IF (= (DTR (ANGLE P1 (LIST (CAR P2) (CADR P1)))) 0.0)
          (setq enp (list (+ (car enp) TS) (- (cadr enp) (/ txt 2))))
          (setq enp (list (- (car enp) TS) (- (cadr enp) (/ txt 2))))
      )
      (IF (= (DTR (ANGLE P1 (LIST (CAR P2) (CADR P1)))) 0.0)
         (command "text" enp txt "0" dis)
         (command "text" "r" enp txt "0" dis)
     )
 (C:T3PX)
)
;----------------------------------------------
;TO DRAW VERT-TURN DIM
(prompt "..")
(defun C:T3PY ()
      (COMMAND "LAYER" "SET" DIMLY "")
      (NULL P1)
      (COMMAND "ORTHO" "OFF")
;     (setq p1 (getpoint "\nFirst Point:"))
      (setq P1 (OSNAP (getpoint "Slect a point:") OSP))
      (setq dis (RTOS (abs (- (car p1) (car op))) 2 A))
      (setq dis (RTOS (/ (atof dis ) scal) 2 A))
      (COMMAND "ORTHO" "OFF")
      (setq p2 (getpoint P1 "\nSecond Point:"))
      (COMMAND "ORTHO" "ON")
      (setq p3 (getpoint P2 "\nThird Point:"))
      (COMMAND "ORTHO" "ON")
      (SETQ ENP P3)
      (IF (= (RTD (ANGLE P1 (LIST (CAR P1) (CADR P2)))) 90.0)
          (SETQ SP (LIST (CAR P1)(+ (CADR P1) BT)))
          (SETQ SP (LIST (CAR P1)(- (CADR P1) BT)))
      )
      (command "line" sp p2 enp "")
      (COMMAND "LAYER" "S" DIMT "")
      (IF (= (RTD (ANGLE P1 (LIST (CAR P1) (CADR P2)))) 90.0)
          (setq enp (list (+ (car enp) (/ txt 2)) (+ (cadr enp) TS)))
          (setq enp (list (+ (car enp) (/ txt 2)) (- (cadr enp) TS)))
      )
      (IF (= (RTD (ANGLE P1 (LIST (CAR P1) (CADR P2)))) 90.0)
         (command "text" enp txt "90" dis)
         (command "text" "r" enp txt "90" dis)
     )
    (C:T3PY)
)
;  -----------------------------------------------------------
;TO DEFUN TURN FUNCTION
(defun C:3PX()
      (COMMAND "LAYER" "SET" DIMLY "")
      (setq P1 (OSNAP (getpoint "Fisrt point:") OSP))
;     (setq p1 (getpoint "\nFirst Point:"))
      (NULL P1)
      (setq dis (RTOS (abs (- (cadr p1) (cadr op))) 2 A))
      (setq dis (RTOS (/ (atof dis ) scal) 2 A))
;     (DIMJUDGEX1)
      (COMMAND "ORTHO" "ON")
      (setq p2 (getpoint P1 "\nSecond Point:"))
      (COMMAND "ORTHO" "OFF")
      (setq p3 (getpoint P2 "\nThird Point:"))
      (COMMAND "ORTHO" "ON")
      (setq p4 (getpoint P3 "\nFourth Point:"))
      (IF (= (RTD (ANGLE P1 (LIST (CAR P2) (CADR P1)))) 0.0)
          (SETQ SP (LIST (+ (CAR P1) BT) (CADR P1)))
          (SETQ SP (LIST (- (CAR P1) BT) (CADR P1)))
      )
      (SETQ ENP P4)
      (command "line" sp  p2 p3 P4 "")
      (COMMAND "LAYER" "S" DIMT "")
      (IF (= (RTD (ANGLE P1 (LIST (CAR P2) (CADR P1)))) 0.0)
          (setq enp (list (+ (car enp) TS) (- (cadr enp) (/ txt 2))))
          (setq enp (list (- (car enp) TS) (- (cadr enp) (/ txt 2))))
      )
      (IF (= (RTD (ANGLE P1 (LIST (CAR P2) (CADR P1)))) 0.0)
         (command "text" enp txt "0" dis)
         (command "text" "r" enp txt "0" dis)
     )
 (C:3PX)
)
;----------------------------------------------
;TO DRAW VERT-TURN DIM
(prompt "..")
(defun C:3PY ()
      (COMMAND "LAYER" "SET" DIMLY "")
      (NULL P1)
      (setq P1 (OSNAP (getpoint "Fisrt point:") OSP))
;     (setq p1 (getpoint "\nFirst Point:"))
      (setq dis (RTOS (abs (- (car p1) (car op))) 2 A))
      (setq dis (RTOS (/ (atof dis ) scal) 2 A))
;     (DIMJUDGEY1)
      (COMMAND "ORTHO" "ON")
      (setq p2 (getpoint P1 "\nSecond Point:"))
      (COMMAND "ORTHO" "OFF")
      (setq p3 (getpoint P2 "\nThird Point:"))
      (COMMAND "ORTHO" "ON")
      (setq p4 (getpoint P3 "\nFourth Point:"))
      (IF (= (RTD (ANGLE P1 (LIST (CAR P1) (CADR P2)))) 90.0)
          (SETQ SP (LIST (CAR P1) (+ (CADR P1) BT)))
          (SETQ SP (LIST (CAR P1) (- (CADR P1) BT)))
      )
      (SETQ ENP P4 )
      (command "line" sp p2 p3 enp "")
      (COMMAND "LAYER" "S" DIMT "")
      (IF (= (RTD (ANGLE P1 (LIST (CAR P1) (CADR P2)))) 90.0)
          (setq enp (list (+ (car enp) (/ txt 2)) (+ (cadr enp) TS)))
          (setq enp (list (+ (car enp) (/ txt 2)) (- (cadr enp) TS)))
      )
      (IF (= (RTD (ANGLE P1 (LIST (CAR P1) (CADR P2)))) 90.0)
         (command "text" enp txt "90" dis)
         (command "text" "r" enp txt "90" dis)
     )
    (C:3PY)
)
;------------------------------------------------------------------------------
(DEFUN CIRVER ()
          (NULL P1)
          (COMMAND "LAYER" "SET" DIMLY "")
          (setq dis (RTOS (abs (- (cadr p1) (cadr op))) 2 A))
          (setq dis (RTOS (/ (atof dis ) scal) 2 A))
          (CIRDGV)
          (setq enp1 (list (car ep) (cadr p1)))
          (command "line" sp enp1 "")
          (COMMAND "LAYER" "S" DIMT "")
          (if (> (car ep) (car p1))
             (setq enp1 (list (+ (car enp1) TS) (- (cadr enp1) (/ txt 2))))
             (setq enp1 (list (- (car enp1) TS) (- (cadr enp1) (/ txt 2))))
          )
          (if (> (car ep) (car p1)) (command "text" enp1 txt "0" dis)
             (command "text" "r" enp1 txt "0" dis))
)
;------------------------------------------------------------------------------
;  -----------------------------------------------------------
;
;  TO DRAW VERI-DIM  FOR AUTOVER  CIRCLE
;
(defun CIRHER ()
    (NULL P1)
    (setq dis (RTOS (abs (- (car p1) (car op))) 2 A))
    (setq dis (RTOS (/ (atof dis ) scal) 2 A))
    (CIRDGH)
    (setq enp (list (car p1) (cadr ep)))
    (command "line" sp enp "")
    (COMMAND "LAYER" "S" DIMT "")
    (if (> (cadr ep) (cadr p1))
        (setq enp (list (+ (car enp) (/ txt 2)) (+ (cadr enp) TS)))
        (setq enp (list (+ (car enp) (/ txt 2)) (- (cadr enp) TS)))
    )
    (if (> (cadr ep) (cadr p1)) (command "text" enp txt "90" dis)
                  (command "text" "r" enp txt "90" dis))
)
;
;------------------------------------------------------------------------------
;=== START SEEK FILE =========
(DEFUN SETTING()
  (SETQ TZ (GETVAR "TEXTSIZE"))
  (IF (< TZ 1.0)
      (SETQ AUSET (FINDFILE "C:/ACAD/HON/AUTOIN.SET"))
      (SETQ AUSET (FINDFILE "C:/ACAD/HON/AUTODIM.SET"))
  )
;===== WHEN NOT NIL =====MM SETTING=====
  (IF (AND (/= AUSET NIL) (> TZ 1.0))
      (PROGN
        (SETQ FC (OPEN "C:/ACAD/HON/AUTODIM.SET" "r"))
        (SETQ DIMLY (READ-LINE FC))
        (SETQ DIMT (READ-LINE FC))
        (SETQ SCAL (READ-LINE FC))
        (SETQ SCAL (ATOF SCAL))
        (SETQ TXT (READ-LINE FC))
        (SETQ TXT (ATOF TXT))
        (SETQ A (READ-LINE FC))
        (SETQ A (ATOI A))
        (SETQ T1 (READ-LINE FC))
        (SETQ T1 (ATOF T1))
        (SETQ BT (READ-LINE FC))
        (SETQ BT (ATOF BT))
        (SETQ TS (READ-LINE FC))
        (SETQ TS (ATOF TS))
        (SETQ OVER (READ-LINE FC))
        (SETQ UNDER (READ-LINE FC))
        (SETQ DBOVER (READ-LINE FC))
        (SETQ OSP (READ-LINE FC))
        (SETQ TEST 4)
        (IF (OR (= SCAL "") (= TXT "") (= DIMT "") (= A "") (= T1 "") (= BT "") (= TS "") (= OVER "")(= UNDER "") (= DBOVER "") (= DIMLY "") (= OSP "")
            (= SCAL NIL) (= TXT NIL) (= A NIL) (= T1 NIL) (= BT NIL) (= TS NIL) (= OVER NIL)(= UNDER NIL)(= DBOVER NIL) (= DIMLY NIL) (= OSP NIL))
            (CLOSE FC)
        )
        (IF (OR (= SCAL "") (= TXT "") (= DIMT "") (= A "") (= T1 "") (= BT "") (= TS "") (= OVER "")(= UNDER "") (= DBOVER "") (= DIMLY "") (= OSP "")
            (= SCAL NIL) (= TXT NIL) (= A NIL) (= T1 NIL) (= BT NIL) (= TS NIL) (= OVER NIL)(= UNDER NIL)(= DBOVER NIL) (= DIMLY NIL) (= OSP NIL))
             (PROGN
                 (PROMPT"\nSETTING DIM EXTEND LINE LAYER:<text>")
                 (setq DIMLY (getSTRING))
                 (IF (OR (= DIMLY "") (= DIMLY NIL))
                     (SETQ DIMLY "text")
                 )
                 (PROMPT"\nSETTING DIM TEXT LAYER:<text>")
                 (setq DIMT (getSTRING))
                 (IF (OR (= DIMT "") (= DIMT NIL))
                     (SETQ DIMT "text")
                 )
                 (PROMPT"\nSETTING VALUE OF SCALE:<1>")
                 (setq scal (getreal))
                 (IF (OR (= SCAL "") (= SCAL NIL))
                     (SETQ SCAL 1)
                 )
;                (COMMAND "SETVAR" "USERR4" SCAL)
                 (PROMPT"\nSETTING DIM TEXT HEIGHT:<3>")
                 (setq txt (getreal))
                 (IF (OR (= TXT "") (= TXT NIL))
                     (SETQ TXT 3)
                 )
                 (PROMPT"\nSETTING NUMBER OF DIGITS:<2>")
                 (setq a (getint))
                 (IF (OR (= A "") (= A NIL))
                     (SETQ A 2)
                 )
                 (PROMPT"\nANGLE OF VALUE TO DIM:(EXMPLE 0=90ø,0.6=30ø,1=45ø,2=60ø) 0---2: <0.6>")
                 (setq t1 (getreal))
                 (IF (OR (= T1 "") (= T1 NIL))
                     (SETQ T1 0.6)
                 )
                 (PROMPT"\nDISTANCE BETWEEN EXTENSION LINE AND SELECT POINT :<1>")
                 (setq bt (getreal))
                 (IF (OR (= BT "") (= BT NIL))
                     (SETQ BT 1)
                  )
                  (PROMPT"\nDISTANCE BETWEEN EXTENSION LINE AND TEXT :<2>")
                  (setq TS (getreal))
                  (IF (OR (= TS "") (= TS NIL))
                      (SETQ TS 2)
                  )
                  (PROMPT"\nVALUE OF OVER :<+0.5>")
                  (setq OVER (getSTRING))
                  (IF (OR (= OVER "") (= OVER NIL))
                      (SETQ OVER "+0.5")
                  )
                  (PROMPT"\nVALUE OF UNDER :<-0.5>")
                  (setq UNDER (getSTRING))
                  (IF (OR (= UNDER "") (= UNDER NIL))
                      (SETQ UNDER "-0.5")
                  )
                  (PROMPT"\nVALUE OF DBOVER :<0.5>")
                  (setq DBOVER (getSTRING))
                  (IF (OR (= DBOVER "") (= DBOVER NIL))
                      (SETQ DBOVER "0.5")
                  )
                  (IF (OR (= OSP "") (= OSP NIL))
                      (SETQ OSP "INT,ENDP,CEN,NODE")
                  )
            =====WRITE TO FILE===================
          (SETQ TEST 5)
                 (SETQ FC (OPEN "C:/ACAD/HON/AUTODIM.SET" "w"))
                 (WRITE-LINE DIMLY FC)
                 (WRITE-LINE DIMT FC)
                 (SETQ SCAL (RTOS SCAL 2 5))
                 (WRITE-LINE SCAL FC)
                 (SETQ TXT (RTOS TXT 2 5))
                 (WRITE-LINE TXT FC)
                 (SETQ A (ITOA A))
                 (WRITE-LINE A FC)
                 (SETQ T1 (RTOS T1 2 5))
                 (WRITE-LINE T1 FC)
                 (SETQ BT (RTOS BT 2 5))
                 (WRITE-LINE BT FC)
                 (SETQ TS (RTOS TS 2 5))
                 (WRITE-LINE TS FC)
                 (WRITE-LINE OVER FC)
                 (WRITE-LINE UNDER FC)
                 (WRITE-LINE DBOVER FC)
                 (WRITE-LINE OSP FC)
                 (CLOSE FC)
             )
        )
      )
  )
;;=================END MM SETTING==========
;===== WHEN NIL INCH SETTING==========
  (IF (AND (/= AUSET NIL) (< TZ 1.0))
      (PROGN
        (SETQ FC (OPEN "C:/ACAD/HON/AUTOIN.SET" "r"))
        (SETQ DIMLY (READ-LINE FC))
        (SETQ DIMT (READ-LINE FC))
        (SETQ SCAL (READ-LINE FC))
        (SETQ SCAL (ATOF SCAL))
        (SETQ TXT (READ-LINE FC))
        (SETQ TXT (ATOF TXT))
        (SETQ A (READ-LINE FC))
        (SETQ A (ATOI A))
        (SETQ T1 (READ-LINE FC))
        (SETQ T1 (ATOF T1))
        (SETQ BT (READ-LINE FC))
        (SETQ BT (ATOF BT))
        (SETQ TS (READ-LINE FC))
        (SETQ TS (ATOF TS))
        (SETQ OVER (READ-LINE FC))
        (SETQ UNDER (READ-LINE FC))
        (SETQ DBOVER (READ-LINE FC))
        (SETQ OSP (READ-LINE FC))
        (IF (OR (= SCAL "") (= DIMLY "") (= DIMT "") (= TXT "") (= A "") (= T1 "") (= BT "") (= TS "") (= OVER "")(= UNDER "") (= DBOVER "") (= DIMLY "") (= OSP "")
            (= SCAL NIL) (= DIMLY NIL) (= DIMT NIL) (= TXT NIL) (= A NIL) (= T1 NIL) (= BT NIL) (= TS NIL) (= OVER NIL)(= UNDER NIL)(= DBOVER NIL) (= DIMLY NIL) (= OSP NIL))
            (CLOSE FC)
         )
        (IF (OR (= DIMLY "") (= DIMT "") (= SCAL "") (= TXT "") (= A "") (= T1 "") (= BT "") (= TS "") (= OVER "")(= UNDER "") (= DBOVER "") (= DIMLY "") (= OSP "")
             (= DIMLY NIL) (= DIMT NIL) (= SCAL NIL) (= TXT NIL) (= A NIL) (= T1 NIL) (= BT NIL) (= TS NIL) (= OVER NIL)(= UNDER NIL)(= DBOVER NIL) (= DIMLY NIL) (= OSP NIL))
             (PROGN
                 (PROMPT"\nSETTING DIM EXTEND LINE LAYER:<text>")
                 (setq DIMLY (getSTRING))
                 (IF (OR (= DIMLY "") (= DIMLY NIL))
                     (SETQ DIMLY "text")
                 )
                 (PROMPT"\nSETTING DIM TEXT LAYER:<text>")
                 (setq DIMT (getSTRING))
                 (IF (OR (= DIMT "") (= DIMT NIL))
                     (SETQ DIMT "text")
                 )
                 (PROMPT"\nSETTING VALUE OF SCALE:<1>")
                 (setq scal (getreal))
                 (IF (OR (= SCAL "") (= SCAL NIL))
                     (SETQ SCAL 1)
                 )
                 (PROMPT"\nSETTING DIM TEXT HEIGHT:<0.118>")
                 (setq txt (getreal))
                 (IF (OR (= TXT "") (= TXT NIL))
                     (SETQ TXT 0.118)
                 )
                 (PROMPT"\nSETTING NUMBER OF DIGITS:<3>")
                 (setq a (getint))
                 (IF (OR (= A "") (= A NIL))
                     (SETQ A 3)
                 )
                 (PROMPT"\nANGLE OF VALUE TO DIM:(EXMPLE 0=90ø,0.6=30ø,1=45ø,2=60ø) 0---2: <0.6>")
                 (setq t1 (getreal))
                 (IF (OR (= T1 "") (= T1 NIL))
                     (SETQ T1 0.6)
                 )
                 (PROMPT"\nDISTANCE BETWEEN EXTENSION LINE AND SELECT POINT :<0.039>")
                 (setq bt (getreal))
                 (IF (OR (= BT "") (= BT NIL))
                     (SETQ BT 0.039)
                  )
                  (PROMPT"\nDISTANCE BETWEEN EXTENSION LINE AND TEXT :<0.078>")
                  (setq TS (getreal))
                  (IF (OR (= TS "") (= TS NIL))
                      (SETQ TS 0.078)
                  )
                  (PROMPT"\nVALUE OF OVER :<+0.5>")
                  (setq OVER (getSTRING))
                  (IF (OR (= OVER "") (= OVER NIL))
                      (SETQ OVER "+0.5")
                  )
                  (PROMPT"\nVALUE OF UNDER :<-0.5>")
                  (setq UNDER (getSTRING))
                  (IF (OR (= UNDER "") (= UNDER NIL))
                      (SETQ UNDER "-0.5")
                  )
                  (PROMPT"\nVALUE OF DBOVER :<0.5>")
                  (setq DBOVER (getSTRING))
                  (IF (OR (= DBOVER "") (= DBOVER NIL))
                      (SETQ DBOVER "0.5")
                  )
                  (IF (OR (= OSP "") (= OSP NIL))
                      (SETQ OSP "INT,ENDP,CEN,NODE")
                  )
;================WRITE TO FILE===================
                 (SETQ FC (OPEN "C:/ACAD/HON/AUTOIN.SET" "w"))
                 (WRITE-LINE DIMLY FC)
                 (WRITE-LINE DIMT FC)
                 (SETQ SCAL (RTOS SCAL 2 5))
                 (WRITE-LINE SCAL FC)
                 (SETQ TXT (RTOS TXT 2 5))
                 (WRITE-LINE TXT FC)
                 (SETQ A (ITOA A))
                 (WRITE-LINE A FC)
                 (SETQ T1 (RTOS T1 2 5))
                 (WRITE-LINE T1 FC)
                 (SETQ BT (RTOS BT 2 5))
                 (WRITE-LINE BT FC)
                 (SETQ TS (RTOS TS 2 5))
                 (WRITE-LINE TS FC)
                 (WRITE-LINE OVER FC)
                 (WRITE-LINE UNDER FC)
                 (WRITE-LINE DBOVER FC)
                 (WRITE-LINE OSP FC)
                 (CLOSE FC)
             )
         )
      )
  )
;;=================END IN SETTING==========
;===== WHEN NIL MM SETING===========
  (IF (AND (= AUSET NIL) (> TZ 1.0))
      (PROGN
         (SETQ TEST 6)
         (SETQ FC (OPEN "C:/ACAD/HON/AUTODIM.SET" "w"))
         (WRITE-LINE "text" FC)
         (WRITE-LINE "text" FC)
         (WRITE-LINE "1" FC)
         (WRITE-LINE "3" FC)
         (WRITE-LINE "2" FC)
         (WRITE-LINE "0.6" FC)
         (WRITE-LINE "1" FC)
         (WRITE-LINE "2" FC)
         (WRITE-LINE "+0.5" FC)
         (WRITE-LINE "-0.5" FC)
         (WRITE-LINE "0.5"  FC)
         (WRITE-LINE "INT,ENDP,CEN,NODE"  FC)
         (CLOSE FC)
      )
  )
;;=================END MM SETTING==========
;===== WHEN NIL INCH SETING===========
  (IF (AND (= AUSET NIL) (< TZ 1.0))
      (PROGN
         (SETQ FC (OPEN "C:/ACAD/HON/AUTOIN.SET" "w"))
         (WRITE-LINE "text" FC)
         (WRITE-LINE "text" FC)
         (WRITE-LINE "1"     FC)
         (WRITE-LINE "0.118" FC)
         (WRITE-LINE "3"     FC)
         (WRITE-LINE "0.6"   FC)
         (WRITE-LINE "0.039" FC)
         (WRITE-LINE "0.078" FC)
         (WRITE-LINE "+0.5"  FC)
         (WRITE-LINE "-0.5"  FC)
         (WRITE-LINE "0.5"   FC)
         (WRITE-LINE "INT,ENDP,CEN,NODE"  FC)
         (CLOSE FC)
      )
  )
;;=================END MM SETTING==========
;================SHOW SETTING MM AND ASK CHANG OR NO==========
   (IF (>= TZ 1.0)
       (PROGN
          (SETQ TEST 123)
          (SETQ FC (OPEN "C:/ACAD/HON/AUTODIM.SET" "r"))
          (SETQ DIMLY (READ-LINE FC))
          (SETQ DIMT (READ-LINE FC))
          (SETQ SCAL (READ-LINE FC))
          (SETQ SCAL (ATOF SCAL))
;         (COMMAND "SETVAR" "USERR4" SCAL)
          (SETQ TXT (READ-LINE FC))
          (SETQ TXT (ATOF TXT))
          (SETQ A (READ-LINE FC))
          (SETQ A (ATOI A))
          (SETQ T1 (READ-LINE FC))
          (SETQ T1 (ATOF T1))
          (SETQ BT (READ-LINE FC))
          (SETQ BT (ATOF BT))
          (SETQ TS (READ-LINE FC))
          (SETQ TS (ATOF TS))
          (SETQ OVER (READ-LINE FC))
          (SETQ UNDER (READ-LINE FC))
          (SETQ DBOVER (READ-LINE FC))
          (SETQ OSP (READ-LINE FC))
          (PROMPT "\n========================================" )
          (PROMPT"\nDIM OF EXTEND LINE LAYER:<") (PROMPT DIMLY) (PROMPT ">")
          (PROMPT"\nDIM OF TEXT LAYER:<") (PROMPT DIMT) (PROMPT ">")
          (PROMPT"\nVALUE OF SCALE:<") (PRIN1 SCAL) (PROMPT ">")
          (PROMPT"\nDIM TEXT HEIGHT:<") (PRIN1 TXT) (PROMPT ">")
          (PROMPT"\nNUMBER OF DIGITS:<") (PRIN1 A) (PROMPT ">")
          (PROMPT"\nANGLE OF VALUE TO DIM:(EXMPLE 0=90ø,0.6=30ø,1=45ø,2=60ø) 0---2  <0.6>:<") (PRIN1 T1) (PROMPT ">")
          (PROMPT"\nDISTANCE BETWEEN EXTENSION LINE AND SELECT POINT :<") (PRIN1 BT) (PROMPT ">")
          (PROMPT"\nDISTANCE BETWEEN EXTENSION LINE AND TEXT :<") (PRIN1 TS) (PROMPT ">")
          (PROMPT"\nVALUE OF OVER :<") (PRIN1 OVER) (PROMPT ">")
          (PROMPT"\nVALUE OF UNDER :<") (PRIN1 UNDER) (PROMPT ">")
          (PROMPT"\nVALUE OF DBOVER :<") (PRIN1 DBOVER) (PROMPT ">")
          (PROMPT"\nOsnap mode:<") (PROMPT OSP) (PROMPT ">")
          (PROMPT "\n========================================" )
          (SETQ ANS (GETSTRING T "\n DO YOU WANT TO CHANGE LAST SETTING ? Yes/<No> :"))
          (SETQ ANS (STRCASE ANS))
          (CLOSE FC)
       )
   )
;=========================
;================SHOW SETTING INCH AND ASK CHANG OR NO==========
   (IF (< TZ 1.0)
       (PROGN
           (SETQ FC (OPEN "C:/ACAD/HON/AUTOIN.SET" "r"))
           (SETQ DIMLY (READ-LINE FC))
           (SETQ DIMT (READ-LINE FC))
           (SETQ SCAL (READ-LINE FC))
           (SETQ SCAL (ATOF SCAL))
;          (COMMAND "SETVAR" "USERR4" SCAL)
           (SETQ TXT (READ-LINE FC))
           (SETQ TXT (ATOF TXT))
           (SETQ A (READ-LINE FC))
           (SETQ A (ATOI A))
           (SETQ T1 (READ-LINE FC))
           (SETQ T1 (ATOF T1))
           (SETQ BT (READ-LINE FC))
           (SETQ BT (ATOF BT))
           (SETQ TS (READ-LINE FC))
           (SETQ TS (ATOF TS))
           (SETQ OVER (READ-LINE FC))
           (SETQ UNDER (READ-LINE FC))
           (SETQ DBOVER (READ-LINE FC))
           (SETQ OSP (READ-LINE FC))
           (PROMPT "\n========================================" )
           (PROMPT"\nDIM EXTEND LINE LAYER:<") (PROMPT DIMLY) (PROMPT ">")
           (PROMPT"\nDIM TEXT LAYER:<") (PROMPT DIMT) (PROMPT ">")
           (PROMPT"\nVALUE OF SCALE:<") (PRIN1 SCAL) (PROMPT ">")
           (PROMPT"\nDIM TEXT HEIGHT:<") (PRIN1 TXT) (PROMPT ">")
           (PROMPT"\nNUMBER OF DIGITS:<") (PRIN1 A) (PROMPT ">")
           (PROMPT"\nANGLE OF VALUE TO DIM:(EXMPLE 0=90ø,0.6=30ø,1=45ø,2=60ø) 0---2  <0.6>:<") (PRIN1 T1) (PROMPT ">")
           (PROMPT"\nDISTANCE BETWEEN EXTENSION LINE AND SELECT POINT :<") (PRIN1 BT) (PROMPT ">")
           (PROMPT"\nDISTANCE BETWEEN EXTENSION LINE AND TEXT :<") (PRIN1 TS) (PROMPT ">")
           (PROMPT"\nVALUE OF OVER :<") (PRIN1 OVER) (PROMPT ">")
           (PROMPT"\nVALUE OF UNDER :<") (PRIN1 UNDER) (PROMPT ">")
           (PROMPT"\nVALUE OF DBOVER :<") (PRIN1 DBOVER) (PROMPT ">")
           (PROMPT"\nOsnao mode      :<") (PROMPT OSP) (PROMPT ">")
           (PROMPT "\n========================================" )
           (SETQ ANS (GETSTRING T "\n DO YOU WANT TO CHANGE LAST SETTING ? Yes/<No> :"))
           (SETQ ANS (STRCASE ANS))
           (CLOSE FC)
    )    )
;=========================
;;===============CHNAGE MM SETTING==========
(IF (AND (= ANS "Y") (> TZ 1))
    (PROGN
       (PROMPT"\nSETTING DIM EXTEND LINE LAYER:<")(PROMPT DIMLY)(PROMPT">")
       (setq DIMLYN (getSTRING))
       (IF (OR (= DIMLYN "") (= DIMLYN NIL))
           (SETQ DIMLYN DIMLY)
       )
       (PROMPT"\nSETTING DIM TEXT LAYER:<")(PROMPT DIMT)(PROMPT">")
       (setq DIMTN (getSTRING))
       (IF (OR (= DIMTN "") (= DIMTN NIL))
           (SETQ DIMTN DIMT)
       )
       (PROMPT"\nSETTING VALUE OF SCALE:<")(PRIN1 SCAL)(PROMPT">")
       (setq SCALN (getreal))
       (IF (OR (= SCALN "") (= SCALN NIL))
           (SETQ SCALN SCAL)
       )
;      (COMMAND "SETVAR" "USERR4" SCALN)
       (PROMPT"\nSETTING DIM TEXT HEIGHT:<")(PRIN1 TXT)(PROMPT">")
       (setq TXTN (getreal))
       (IF (OR (= TXTN "") (= TXTN NIL))
           (SETQ TXTN TXT)
       )
       (PROMPT"\nSETTING NUMBER OF DIGITS:<")(PRIN1 A)(PROMPT">")
       (setq aN (getint))
       (IF (OR (= AN "") (= AN NIL))
           (SETQ AN A)
       )
       (PROMPT"\nANGLE OF VALUE TO DIM:(EXMPLE 0=90ø,0.6=30ø,1=45ø,2=60ø) 0---2: <")(PRIN1 T1)(PROMPT">")
       (setq t1N (getreal))
       (IF (OR (= T1N "") (= T1N NIL))
           (SETQ T1N T1)
       )
       (PROMPT"\nDISTANCE BETWEEN EXTENSION LINE AND SELECT POINT :<")(PRIN1 BT)(PROMPT">")
       (setq btN (getreal))
       (IF (OR (= BTN "") (= BTN NIL))
           (SETQ BTN BT)
        )
        (PROMPT"\nDISTANCE BETWEEN EXTENSION LINE AND TEXT :<")(PRIN1 TS)(PROMPT">")
        (setq TSN (getreal))
        (IF (OR (= TSN "") (= TSN NIL))
            (SETQ TSN TS)
        )
        (PROMPT"\nVALUE OF OVER :<")(PRIN1 OVER)(PROMPT">")
        (setq OVERN (getSTRING))
        (IF (OR (= OVERN "") (= OVERN NIL))
            (SETQ OVERN OVER)
        )
        (PROMPT"\nVALUE OF UNDER :<")(PRIN1 UNDER)(PROMPT">")
        (setq UNDERN (getSTRING))
        (IF (OR (= UNDERN "") (= UNDERN NIL))
            (SETQ UNDERN UNDER)
        )
        (PROMPT"\nVALUE OF DBOVER :<")(PRIN1 DBOVER)(PROMPT">")
        (setq DBOVERN (getSTRING))
        (IF (OR (= DBOVERN "") (= DBOVERN NIL))
            (SETQ DBOVERN DBOVER)
        )
        (PROMPT"\nOsnap mode :<")(PRIN1 OSP)(PROMPT">")
        (setq OSPN (getSTRING))
        (IF (OR (= OSPN "") (= OSPN NIL))
            (SETQ OSPN OSP)
        )
        (SETQ FC (OPEN "C:/ACAD/HON/AUTODIM.SET" "w"))
;       (COMMAND "SETVAR" "USERR4" SCALN)
        (WRITE-LINE DIMLYN FC)
        (WRITE-LINE DIMTN FC)
        (SETQ SCALN (RTOS SCALN 2 5))
        (WRITE-LINE SCALN FC)
        (SETQ TXTN (RTOS TXTN 2 5))
        (WRITE-LINE TXTN FC)
        (SETQ AN (ITOA AN))
        (WRITE-LINE AN FC)
        (SETQ T1N (RTOS T1N 2 5))
        (WRITE-LINE T1N FC)
        (SETQ BTN (RTOS BTN 2 5))
        (WRITE-LINE BTN FC)
        (SETQ TSN (RTOS TSN 2 5))
        (WRITE-LINE TSN FC)
        (WRITE-LINE OVERN FC)
        (WRITE-LINE UNDERN FC)
        (WRITE-LINE DBOVERN FC)
        (WRITE-LINE OSPN FC)
        (CLOSE FC)
    )
)
;;=================END MM CHANGE SETTING==========
;;===============CHNAGE INCH SETTING==========
(IF (AND (= ANS "Y") (< TZ 1))
    (PROGN
       (PROMPT"\nSETTING DIM EXTEND LAYER:<")(PROMPT DIMLY)(PROMPT">")
       (setq DIMLYN (getSTRING))
       (IF (OR (= DIMLYN "") (= DIMLYN NIL))
           (SETQ DIMLYN DIMLY)
       )
       (PROMPT"\nSETTING DIM TEXT LAYER:<")(PROMPT DIMT)(PROMPT">")
       (setq DIMTN (getSTRING))
       (IF (OR (= DIMTN "") (= DIMTN NIL))
           (SETQ DIMTN DIMT)
       )
       (PROMPT"\nSETTING VALUE OF SCALE:<")(PRIN1 SCAL)(PROMPT">")
       (setq SCALN (getreal))
       (IF (OR (= SCALN "") (= SCALN NIL))
           (SETQ SCALN SCAL)
       )
       (PROMPT"\nSETTING DIM TEXT HEIGHT:<")(PRIN1 TXT)(PROMPT">")
       (setq TXTN (getreal))
       (IF (OR (= TXTN "") (= TXTN NIL))
           (SETQ TXTN TXT)
       )
       (PROMPT"\nSETTING NUMBER OF DIGITS:<")(PRIN1 A)(PROMPT">")
       (setq aN (getint))
       (IF (OR (= AN "") (= AN NIL))
           (SETQ AN A)
       )
       (PROMPT"\nANGLE OF VALUE TO DIM:(EXMPLE 0=90ø,0.6=30ø,1=45ø,2=60ø) 0---2: <")(PRIN1 T1)(PROMPT">")
       (setq t1N (getreal))
       (IF (OR (= T1N "") (= T1N NIL))
           (SETQ T1N T1)
       )
       (PROMPT"\nDISTANCE BETWEEN EXTENSION LINE AND SELECT POINT :<")(PRIN1 BT)(PROMPT">")
       (setq btN (getreal))
       (IF (OR (= BTN "") (= BTN NIL))
           (SETQ BTN BT)
        )
        (PROMPT"\nDISTANCE BETWEEN EXTENSION LINE AND TEXT :<")(PRIN1 TS)(PROMPT">")
        (setq TSN (getreal))
        (IF (OR (= TSN "") (= TSN NIL))
            (SETQ TSN TS)
        )
        (PROMPT"\nVALUE OF OVER :<")(PRIN1 OVER)(PROMPT">")
        (setq OVERN (getSTRING))
        (IF (OR (= OVERN "") (= OVERN NIL))
            (SETQ OVERN OVER)
        )
        (PROMPT"\nVALUE OF UNDER :<")(PRIN1 UNDER)(PROMPT">")
        (setq UNDERN (getSTRING))
        (IF (OR (= UNDERN "") (= UNDERN NIL))
            (SETQ UNDERN UNDER)
        )
        (PROMPT"\nVALUE OF DBOVER :<")(PRIN1 DBOVER)(PROMPT">")
        (setq DBOVERN (getSTRING))
        (IF (OR (= DBOVERN "") (= DBOVERN NIL))
            (SETQ DBOVERN DBOVER)
        )
        (PROMPT"\nOsnap mode :<")(PRIN1 OSP)(PROMPT">")
        (setq OSPN (getSTRING))
        (IF (OR (= OSPN "") (=OSPN NIL))
            (SETQ OSPN OSP)
        )
        (SETQ FC (OPEN "C:/ACAD/HON/AUTOIN.SET" "w"))
        (WRITE-LINE DIMLYN FC)
        (WRITE-LINE DIMTN FC)
        (SETQ SCALN (RTOS SCALN 2 5))
        (WRITE-LINE SCALN FC)
        (SETQ TXTN (RTOS TXTN 2 5))
        (WRITE-LINE TXTN FC)
        (SETQ AN (ITOA AN))
        (WRITE-LINE AN FC)
        (SETQ T1N (RTOS T1N 2 5))
        (WRITE-LINE T1N FC)
        (SETQ BTN (RTOS BTN 2 5))
        (WRITE-LINE BTN FC)
        (SETQ TSN (RTOS TSN 2 5))
        (WRITE-LINE TSN FC)
        (WRITE-LINE OVERN FC)
        (WRITE-LINE UNDERN FC)
        (WRITE-LINE DBOVERN FC)
        (WRITE-LINE OSPN FC)
        (CLOSE FC)
    )
)
;;=================END MM CHANGE SETTING==========
;================SHOW MM LAST SETTING ==========
(IF (AND (= ANS "Y") (> TZ 1))
   (PROGN
      (SETQ FC (OPEN "C:/ACAD/HON/AUTODIM.SET" "r"))
      (SETQ DIMLY (READ-LINE FC))
      (SETQ DIMT (READ-LINE FC))
      (SETQ SCAL (READ-LINE FC))
      (SETQ SCAL (ATOF SCAL))
      (SETQ TXT (READ-LINE FC))
      (SETQ TXT (ATOF TXT))
      (SETQ A (READ-LINE FC))
      (SETQ A (ATOI A))
      (SETQ T1 (READ-LINE FC))
      (SETQ T1 (ATOF T1))
      (SETQ BT (READ-LINE FC))
      (SETQ BT (ATOF BT))
      (SETQ TS (READ-LINE FC))
      (SETQ TS (ATOF TS))
      (SETQ OVER (READ-LINE FC))
      (SETQ UNDER (READ-LINE FC))
      (SETQ DBOVER (READ-LINE FC))
      (SETQ OSP (READ-LINE FC))
      (PROMPT "\n========================================" )
      (PROMPT"\nSETTING DIM EXTEND LINE LAYER:<") (PROMPT DIMLY) (PROMPT ">")
      (PROMPT"\nSETTING DIM TEXT LAYER:<") (PROMPT DIMT) (PROMPT ">")
      (PROMPT"\nSETTING VALUE OF SCALE:<") (PRIN1 SCAL) (PROMPT ">")
      (PROMPT"\nSETTING DIM TEXT HEIGHT:<") (PRIN1 TXT) (PROMPT ">")
      (PROMPT"\nSETTING NUMBER OF DIGITS:<") (PRIN1 A) (PROMPT ">")
      (PROMPT"\nANGLE OF VALUE TO DIM:(EXMPLE 0=90ø,0.6=30ø,1=45ø,2=60ø) 0---2  <0.6>:<") (PRIN1 T1) (PROMPT ">")
      (PROMPT"\nDISTANCE BETWEEN EXTENSION LINE AND SELECT POINT :<") (PRIN1 BT) (PROMPT ">")
      (PROMPT"\nDISTANCE BETWEEN EXTENSION LINE AND TEXT :<") (PRIN1 TS) (PROMPT ">")
      (PROMPT"\nVALUE OF OVER :<") (PRIN1 OVER) (PROMPT ">")
      (PROMPT"\nVALUE OF UNDER :<") (PRIN1 UNDER) (PROMPT ">")
      (PROMPT"\nVALUE OF DBOVER :<") (PRIN1 DBOVER) (PROMPT ">")
      (PROMPT"\nOsnap mode :<") (PROMPT OSP) (PROMPT ">")
      (PROMPT "\n========================================" )
      (CLOSE FC)
   )
)
;=========================
;================SHOW INCH LAST SETTING ==========
(IF (AND (= ANS "Y") (< TZ 1))
   (PROGN
      (SETQ FC (OPEN "C:/ACAD/HON/AUTOIN.SET" "r"))
      (SETQ DIMLY (READ-LINE FC))
      (SETQ DIMT (READ-LINE FC))
      (SETQ SCAL (READ-LINE FC))
      (SETQ SCAL (ATOF SCAL))
      (SETQ TXT (READ-LINE FC))
      (SETQ TXT (ATOF TXT))
      (SETQ A (READ-LINE FC))
      (SETQ A (ATOI A))
      (SETQ T1 (READ-LINE FC))
      (SETQ T1 (ATOF T1))
      (SETQ BT (READ-LINE FC))
      (SETQ BT (ATOF BT))
      (SETQ TS (READ-LINE FC))
      (SETQ TS (ATOF TS))
      (SETQ OVER (READ-LINE FC))
      (SETQ UNDER (READ-LINE FC))
      (SETQ DBOVER (READ-LINE FC))
      (SETQ OSP (READ-LINE FC))
      (PROMPT "\n========================================" )
      (PROMPT"\nSETTING DIM EXTENDLINE LAYER:<") (PROMPT DIMLY) (PROMPT ">")
      (PROMPT"\nSETTING DIM TEXT LAYER:<") (PROMPT DIMT) (PROMPT ">")
      (PROMPT"\nSETTING VALUE OF SCALE:<") (PRIN1 SCAL) (PROMPT ">")
      (PROMPT"\nSETTING DIM TEXT HEIGHT:<") (PRIN1 TXT) (PROMPT ">")
      (PROMPT"\nSETTING NUMBER OF DIGITS:<") (PRIN1 A) (PROMPT ">")
      (PROMPT"\nANGLE OF VALUE TO DIM:(EXMPLE 0=90ø,0.6=30ø,1=45ø,2=60ø) 0---2  <0.6>:<") (PRIN1 T1) (PROMPT ">")
      (PROMPT"\nDISTANCE BETWEEN EXTENSION LINE AND SELECT POINT :<") (PRIN1 BT) (PROMPT ">")
      (PROMPT"\nDISTANCE BETWEEN EXTENSION LINE AND TEXT :<") (PRIN1 TS) (PROMPT ">")
      (PROMPT"\nVALUE OF OVER :<") (PRIN1 OVER) (PROMPT ">")
      (PROMPT"\nVALUE OF UNDER :<") (PRIN1 UNDER) (PROMPT ">")
      (PROMPT"\nVALUE OF DBOVER :<") (PRIN1 DBOVER) (PROMPT ">")
      (PROMPT"\nOsnap mode      :<") (PROMPT OSP) (PROMPT ">")
      (PROMPT "\n========================================" )
      (CLOSE FC)
   )
)
);END DEFUN
(prompt "ok    ")
