;**************** DETAIL ********************
;(IF (= (TYPE F1) 'FILE ) "YES"  (STOP))
;(IF (= (TYPE F2) 'FILE ) "YES" (STOP))
(DEFUN C:DETS()
  (SETQ PNN NIL FIGC NIL FIGG NIL P1 NIL P2 NIL P3 NIL P4 NIL DELTA 0
        ps NIL PE NIL D NIL D1 NIL D2 NIL D3 NIL PN NIL
        V (DTR 45) VV (DTR 225)    )
  (SETQ ORGLAYER  (GETVAR "CLAYER"))
  (SETQ ORGANGDIR (GETVAR "ANGDIR"))
  (SETVAR "ANGDIR"    0)
  (SETVAR "HIGHLIGHT" 0)
  (SETVAR "CMDECHO"   0)

;****** SELECT OBJ & COPYING TO POSITION OF USER'S ******
  (SETQ C1 (ENTGET (CAR (ENTSEL"\n Select area by a CIRCLE:"))))
  (SETQ PPO (GETPOINT "\nCHOOSE ORIGIN POINT:"))
  (SETQ P  (GETPOINT "\n POINT of displacement"))
  (SETQ X  (GETreal "\n Scale factor: "))
  (SETQ CIRP (CDR (ASSOC 10 C1)) )
  (SETQ R (CDR (ASSOC 40 C1)) )
  (SETQ D ( SQRT (*  (* R R ) 2))  )
  (SETQ P1 (POLAR CIRP VV D))
  (SETQ P2 (POLAR CIRP V D))
  (SETQ PPN (POLAR P (ANGLE CIRP PPO) (* (DISTANCE CIRP PPO) X)))
  (COMMAND "COPY"  "C" P1 P2 "" CIRP P)
;****** EXPLODE & GET TRIM EDGE CIRCLE ******
  (SETQ P1 (POLAR P VV D))
  (SETQ P2 (POLAR P V D))
  (COMMAND "SCALE" "C" P1 P2 "" P X)
  (SETQ R (* R X))
  (SETQ D ( SQRT (*  (* R R) 2))  )
  (SETQ P1 (POLAR P VV D))
  (SETQ P2 (POLAR P V D))
  (SETQ FIGC (SSGET "C" P1 P2 ) )
  (SETQ W (SSLENGTH FIGC))
  (SETQ IND 0)
  (REPEAT W
   (SETQ FIGG (ENTGET (SSNAME FIGC IND)))
   (SETQ PNA (CDR (ASSOC 0 FIGG)))
   (SETQ PN  (CDR (ASSOC -1 FIGG)))

   (IF (OR (= PNA "POLYLINE") (= PNA "INSERT") (= PNA "POLYGON")
           (= PNA "BLOCK")  )
    (COMMAND "EXPLODE" PN)
   )

   (IF  (= PNA "CIRCLE" ) (PROGN
    (SETQ RA (CDR (ASSOC 40 FIGG)) )
    (IF (= RA R)
     (SETQ PNN PN  CIP0 (CDR (ASSOC 10 FIGG))
           X0 (CAR CIP0) Y0 (CADR CIP0) R0 RA
     )
    )
   ))
   (SETQ IND (+ IND 1))
  );ENDREPEAT

  (SETQ FIGC NIL)
  (SETQ FIGC (SSGET "C" P1 P2 ) )
  (SETQ W (SSLENGTH FIGC))
  (SETQ IND 0)
  (REPEAT  W
   (SETQ FIGG  (ENTGET (SSNAME FIGC IND)))
   (SETQ PN    (CDR (ASSOC -1 FIGG)))
   (SETQ NAMES (CDR (ASSOC 0 FIGG)))

   (IF (= NAMES "LINE" )
      (DA9LINESUB)
   ) ;ENDIF OF LINE

   (IF (AND (= NAMES "CIRCLE") (NOT (EQUAL PN PNN)) ) (PROGN
    (SETQ CIP1 (CDR (ASSOC 10 FIGG)))
    (SETQ R1 (CDR (ASSOC 40 FIGG)))
    (SETQ D12  (DISTANCE CIP1 CIP0))
    (IF (>= D12 (+ R1 R0)) (COMMAND "ERASE" PN "") )
    (IF (AND (< D12 (+ R1 R0))  (> D12 (- R0 R1))) (DA9CIRCLESUB) )
   ));ENDIF OF CIRCLE

   (IF  (= NAMES "ARC")  (PROGN
    (SETQ DA9ARCDELTA T)
    (SETQ CIP1 (CDR (ASSOC 10 FIGG)))
    (SETQ R1 (CDR (ASSOC 40 FIGG)))
    (SETQ R0F (ATOF (RTOS R0 2 5)))

    (SETQ ANGSS (CDR (ASSOC 50 FIGG)))
    (SETQ PSS (POLAR CIP1 ANGSS R1))
    (SETQ ANGSS (ATOF (RTOS ANGSS 2 5)))

    (SETQ ANGEO (CDR (ASSOC 51 FIGG)))
    (IF (< ANGEO ANGSS) (SETQ ANGEE (+ ANGEO (* 2 PI)))  (SETQ ANGEE ANGEO) )
    (SETQ PEE (POLAR CIP1 ANGEE R1))
    (SETQ ANGEO (ATOF (RTOS ANGEO 2 5)))
    (SETQ ANGEE (ATOF (RTOS ANGEE 2 5)))

    (SETQ ANGMM (/ (+ ANGSS ANGEE) 2) )
    (SETQ PMM (POLAR CIP1 ANGMM R1))
    (SETQ ANGMM (ATOF (RTOS ANGMM 2 5)))

    (SETQ D12 (ATOF (RTOS (DISTANCE CIP1 CIP0) 2 5)))
    (SETQ DSS (ATOF (RTOS (DISTANCE CIP0 PSS)  2 5)))
    (SETQ DEE (ATOF (RTOS (DISTANCE CIP0 PEE)  2 5)))
    (SETQ DMM (ATOF (RTOS (DISTANCE CIP0 PMM)  2 5)))

    (IF (>= D12 (+ R1 R0)) (PROGN
     (COMMAND "ERASE" PN "")
     (SETQ DA9ARCDELTA NIL )
    ))
    (IF (<= D12 (- R0 R1)) (SETQ DA9ARCDELTA NIL )  )

    (IF (AND (= DSS R0F) (= DEE R0F) (> DMM R0F) ) (progn
     (COMMAND "ERASE" PN "")
     (SETQ DA9ARCDELTA NIL )
    ))
    (IF (/= DA9ARCDELTA NIL) (DA9CIRCLESUB) )
   ));ENDIF OF ARC

   (IF (= NAMES "TEXT") (PROGN
    (SETQ A72 (CDR (ASSOC 72 FIGG)))

    (IF (OR (= A72 0.0) (= A72 3.0) (= A72 5.0)) (PROGN
     (SETQ A10 (ASSOC 10 FIGG))
     (SETQ A10X (CADR  A10))
     (SETQ A10Y (CADDR A10))
     (COMMAND "SCALE" PN "" (LIST A10X A10Y) (/ 1 x))
    ))
    (IF (OR (= A72 1.0) (= A72 2.0) (= A72 4.0)) (PROGN
     (SETQ A11 (ASSOC 11 FIGG))
     (SETQ A11X (CADR  A11))
     (SETQ A11Y (CADDR A11))
     (COMMAND "SCALE" PN "" (LIST A11X A11Y) (/ 1 x))
    ))
   ));ENDIF OF TEXT

       (SETQ IND (+ IND 1))
  );ENDREPEAT


  (SETVAR "HIGHLIGHT" 1)
  (SETVAR "CMDECHO"   1)
  (SETVAR "ANGDIR" ORGANGDIR)
  (COMMAND "LAYER" "S" ORGLAYER "")
  (PROMPT "\n JOB FINISH !!!")
;------------ AUTODIMENTION START -----------------
    (COND ((NULL C:MDIMCONT)
         (PROMPT "PLEASE WAIT... LOADING")
         (LOAD "C:/acad/LSP/DIM")
         )
    )
  (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))
        (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 LAYER:<DIM1>")
                 (setq DIMLY (getSTRING))
                 (IF (OR (= DIMLY "") (= DIMLY NIL))
                     (SETQ DIMLY "DIM1")
                 )
                 (PROMPT"\nSETTING DIM TEXT LAYER:<DIM1>")
                 (setq DIMT (getSTRING))
                 (IF (OR (= DIMT "") (= DIMT NIL))
                     (SETQ DIMT "DIM1")
                 )
                 (PROMPT"\nSETTING VALUE OF SCALE:<1>")
                 (setq scal (getreal))
                 (IF (OR (= SCAL "") (= SCAL NIL))
                     (SETQ SCAL 1)
                 )
                 (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,INSERT")
                  )
            =====WRITE TO FILE===================
                 (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 "")
             (= DIMLY NIL) (= DIMT NIL) (= SCAL NIL) (= TXT NIL) (= A NIL) (= T1 NIL) (= BT NIL) (= TS NIL) (= OVER NIL)(= UNDER NIL)(= DBOVER NIL) (= DIMLY NIL))
             (PROGN
                 (PROMPT"\nSETTING DIM LAYER:<DIM1>")
                 (setq DIMLY (getSTRING))
                 (IF (OR (= DIMLY "") (= DIMLY NIL))
                     (SETQ DIMLY "DIM1")
                 )
                 (PROMPT"\nSETTING DIM TEXT LAYER:<DIM1>")
                 (setq DIMT (getSTRING))
                 (IF (OR (= DIMT "") (= DIMT NIL))
                     (SETQ DIMT "DIM1")
                 )
                 (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")
                  )
                  (PROMPT"\nOsnap mode :<INT,ENDP,CEN,NODE,INSERT>")
                  (setq OSP (getSTRING))
                  (IF (OR (= OSP "") (= OSP NIL))
                      (SETQ OSP "INT,ENDP,CEN,NODE,INSERT")
                  )
;================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 FC (OPEN "c:/acad/HON/AUTODIM.SET" "w"))
         (WRITE-LINE "DIM1" FC)
         (WRITE-LINE "DIM1" 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,INSERT"  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 "DIM1" FC)
         (WRITE-LINE "DIM1" 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,INSERT"   FC)
         (CLOSE FC)
      )
  )
;*--------------SHOW MM SETTING --------------
(IF (AND (= ANS "Y") (> TZ 1))
    (PROGN
       (PROMPT"\nSETTING DIMESION OF LAYER:<")(PRIN1 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)
       )
       (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 :<")(PROMPT OSP)(PROMPT">")
        (setq OSPN (getSTRING))
        (IF (OR (= OSPN "") (= OSPN NIL))
            (SETQ OSPN OSP)
        )
        (SETQ FC (OPEN "c:/acad/HON/AUTODIM.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==========
;;===============CHNAGE INCH SETTING==========
(IF (AND (= ANS "Y") (< TZ 1))
    (PROGN
       (PROMPT"\nSETTING DIM OF LAYER:<")(PRIN1 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 :<")(PROMPT OSP)(PROMPT">")
        (setq OSPN (getSTRING))
        (IF (OR (= OSPN "") (= DSPPN 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)
    )
)

    (EXTLI)
    (SETQ USRSCAL SCAL)
    (IF (/= USRSCAL 1.0)
        (SETQ USRSCAL 1.0)
    )
    (SETQ SCAL (* 1 X))
    (SETQ OP PPN)
    (SETQ NOPX (CAR PPN))
    (SETQ NOPY (CADR PPN))
    (COMMAND "SETVAR" "USERR1" NOPX)
    (COMMAND "SETVAR" "USERR2" NOPY)
    (COMMAND "SETVAR" "USERR3" X)
);ENDDEFUN
;
;================================================================
  (DEFUN DA9LINESUB ()
    (SETQ PN  (CDR (ASSOC -1 FIGG)))
    (SETQ PST (CDR (ASSOC 10 FIGG)))
    (SETQ PET (CDR (ASSOC 11 FIGG)))
    (SETQ X1 (CAR  PST ))
    (SETQ Y1 (CADR PST ))
    (SETQ X2 (CAR  PET ))
    (SETQ Y2 (CADR PET ))
    (SETQ Y2Y1 (ATOF (RTOS (- Y2 Y1)2 4)))

    (IF (= Y2Y1 0) (PROGN
     (SETQ B (* -2 X0))
     (SETQ C (+ (* X0 X0) (* (- Y1 Y0) (- Y1 Y0)) (* -1 R0 R0)))
     (SETQ DELTA (- (* B B) (* 4 C)))
     (IF (< DELTA 0) (COMMAND "ERASE" PN ""))
     (IF (>= DELTA 0) (PROGN
      (SETQ XA1 (/ (+ (* -1 B) (SQRT DELTA)) 2))
      (SETQ XA2 (/ (- (* -1 B) (SQRT DELTA)) 2))
      (SETQ PLL1 (LIST XA1 Y1))
      (SETQ PLL2 (LIST XA2 Y1))
        (DA9LINESUB-1)
     ))
    ))

    (IF (/= Y2Y1 0) (PROGN
     (SETQ A (- Y2 Y1))
     (SETQ B (- X2 X1))

     (SETQ AA (/ B A))
     (SETQ BB (- X1 (* AA Y1)))

     (SETQ A- (+ (* AA AA) 1))
     (SETQ B- (* 2 (- (* BB AA) (* X0 AA) Y0)))
     (SETQ C- (+ (* BB BB) (* -2 X0 BB) (* X0 X0) (* Y0 Y0) (* -1 R0 R0)))

     (SETQ DELTA (- (* B- B-) (* 4 A- C-)))
     (IF (< DELTA 0) (COMMAND "ERASE" PN ""))
     (IF (>= DELTA 0) (PROGN
      (SETQ YA  (/ (+ (* -1 B-) (SQRT DELTA)) (* 2 A-) ))
      (SETQ YB  (/ (- (* -1 B-) (SQRT DELTA)) (* 2 A-) ))
      (SETQ XA (+ (* YA (/ B A)) (- X1 (* Y1 (/ B A))) ))
      (SETQ XB (+ (* YB (/ B A)) (- X1 (* Y1 (/ B A))) ))
      (SETQ PLL1 (LIST XA  YA))
      (SETQ PLL2 (LIST XB  YB))
        (DA9LINESUB-1)
     ))
    ))

  );ENDDEFUN OF LINE
  ;-----------------------------------------------------------
  (DEFUN DA9LINESUB-1 ()
    (SETQ TESTBA (ABS (- (ANGLE PLL1 PLL2) (ANGLE PST PET))))
    (SETQ TESTCA (ABS (- (ANGLE PLL2 PLL1) (ANGLE PST PET))))
    (IF (< TESTBA TESTCA) (SETQ PLLS PLL1 PLLE PLL2) (SETQ PLLS PLL2 PLLE PLL1) )

    (IF (AND (>= (DISTANCE P PST) R0) (>= (DISTANCE P PET) R0) ) (PROGN
      (IF (OR (> (DISTANCE PST PLLS) (DISTANCE PST PET))
              (> (DISTANCE PET PLLE) (DISTANCE PET PST)) )
        (COMMAND "ERASE" PN "")
        (PROGN
         (SETQ FIGG (SUBST (CONS 10 PLLS) (ASSOC 10 FIGG) FIGG))
         (SETQ FIGG (SUBST (CONS 11 PLLE) (ASSOC 11 FIGG) FIGG))
         (ENTMOD FIGG)
      ))
    ))

    (IF (AND (>= (DISTANCE P PST) R0) (<= (DISTANCE P PET) R0) )
     (ENTMOD (SUBST (CONS 10 PLLS) (ASSOC 10 FIGG) FIGG))
    )
    (IF (AND (<= (DISTANCE P PST) R0) (>= (DISTANCE P PET) R0) )
     (ENTMOD (SUBST (CONS 11 PLLE) (ASSOC 11 FIGG) FIGG))
    )

   );ENDDEFUN OF LINESUB-1
  ;=============================================
   (DEFUN DA9CIRCLESUB ()
    (SETQ AA NIL BB NIL CC NIL DELTX NIL DELTY NIL DELTA0 NIL DELTA1 NIL
          ANS1 NIL ANS2 NIL ANS3 NIL ANS4 NIL INP1 NIL INP2 NIL INP3 NIL
    )
    (SETQ X1 (CAR CIP1))
    (SETQ Y1 (CADR CIP1))
    (SETQ AA (ATOF (RTOS (* 2 (- X1 X0) ) 2 5 ) ) )
    (SETQ BB (ATOF (RTOS (* 2 (- Y1 Y0) ) 2 5 ) ) )
    (SETQ CC (+ (* X0 X0) (* X1 X1 -1) (* Y0 Y0) (* Y1 Y1 -1) (* R1 R1) (* R0 R0 -1) ) )
    (IF (= AA 0) (PROGN
     (SETQ YA (/ (* -1 CC) BB))
     (SETQ A-  1)
     (SETQ B- (* -2 X0))
     (SETQ C- (+ (* X0 X0) (* (- YA Y0) (- YA Y0)) (* -1 R0 R0)))
     (SETQ DELTX  (- (* B- B-) (* 4 A- C-) ))
     (IF (>= DELTX 0) (PROGN
      (SETQ DELTX (SQRT DELTX))
      (SETQ XA1 (/ (+ (* -1 B-) DELTX) 2))
      (SETQ XA2 (/ (- (* -1 B-) DELTX) 2))
      (SETQ INP1  (LIST XA1 YA))
      (SETQ INP2  (LIST XA2 YA))
     ))
    ))
    (IF (/= AA 0) (PROGN
     (SETQ A- (+ (/ (* BB BB) (* AA AA)) 1))
     (SETQ B- (* 2 (+ (/ (* BB CC) (* AA AA))  (/ (* X0 BB) AA)  (* -1 Y0))))
     (SETQ C- (+ (/ (* CC CC) (* AA AA))  (/ (* 2 X0 CC) AA) (* X0 X0) (* Y0 Y0) (* -1 R0 R0) ))
     (SETQ DELTY  (- (* B- B-) (* 4 A- C-) ))
     (IF (>= DELTY 0) (PROGN
      (SETQ DELTY (SQRT DELTY))
      (SETQ YA  (/ (+ (* -1 B-) DELTY) (* 2 A-) ))
      (SETQ YB  (/ (- (* -1 B-) DELTY) (* 2 A-) ))
      (SETQ A 1)
      (SETQ B (* -2 X0))
      (SETQ C (+ (* X0 X0) (* (- YA Y0) (- YA Y0)) (* -1 R0 R0)))
      (SETQ DELTA0 (- (* B B) (* 4 A C)))
      (IF (>= DELTA0 0) (PROGN
       (SETQ XA1 (/ (+ (* -1 B) (SQRT DELTA0)) 2))
       (SETQ XA2 (/ (- (* -1 B) (SQRT DELTA0)) 2))
       (SETQ ANS1 (ATOF (RTOS (+ (* (- XA1 X1) (- XA1 X1)) (* (- YA Y1) (- YA Y1)) (* -1 R1 R1) ) 2 4)))
       (SETQ ANS2 (ATOF (RTOS (+ (* (- XA2 X1) (- XA2 X1)) (* (- YA Y1) (- YA Y1)) (* -1 R1 R1) ) 2 4)))
       (IF (< (ABS ANS1) (ABS ANS2))
        (SETQ INP1  (LIST XA1 YA))
        (SETQ INP1  (LIST XA2 YA))
       )
      ))

      (SETQ C (+ (* X0 X0) (* (- YB Y0) (- YB Y0)) (* -1 R0 R0)))
      (SETQ DELTA1 (- (* B B) (* 4 A C)))
      (IF (>= DELTA1 0) (PROGN
       (SETQ XB1 (/ (+ (* -1 B) (SQRT DELTA1)) 2))
       (SETQ XB2 (/ (- (* -1 B) (SQRT DELTA1)) 2))
       (SETQ ANS3 (ATOF (RTOS (+ (* (- XB1 X1) (- XB1 X1)) (* (- YB Y1) (- YB Y1)) (* -1 R1 R1) ) 2 4)))
       (SETQ ANS4 (ATOF (RTOS (+ (* (- XB2 X1) (- XB2 X1)) (* (- YB Y1) (- YB Y1)) (* -1 R1 R1) ) 2 4)))
       (IF (< (ABS ANS3) (ABS ANS4))
        (SETQ INP2  (LIST XB1 YB))
        (SETQ INP2  (LIST XB2 YB))
       )
      ))
     ))
    ))
    (IF (AND (= NAMES "CIRCLE" ) (/= INP1 NIL) (/= INP2 NIL) )
     (PROGN
      (SETQ INP3 (POLAR CIP1 (ANGLE CIP1 CIP0) R1))
      (COMMAND "LAYER" "S"  (CDR (ASSOC 8 FIGG)) "")
      (COMMAND "ERASE" PN "")
      (COMMAND "ARC" INP1 INP3 INP2 )
    ))

    (IF (AND (= NAMES "ARC") (/= INP1 NIL) (/= INP2 NIL)) (DA9ARCALFA))
  );ENDDEFUN OF DA9CIRCLESUB
  ;-----------------------------------------------------------
  (DEFUN DA9ARCALFA ()
    (SETQ ANGP1 (ATOF (RTOS (ANGLE CIP1 INP1) 2 5)))
    (SETQ ANGP2 (ATOF (RTOS (ANGLE CIP1 INP2) 2 5)))
    (SETQ PAA (POLAR CIP1 (ANGLE CIP0 CIP1) R1))
    (SETQ ANGPA (ATOF (RTOS (ANGLE CIP0 PAA) 2 5)))
    (IF (> ANGEE (DTR 360)) (PROGN
     (IF (AND (>= ANGEO ANGP1) (>= ANGP1 (DTR 0)))
      (SETQ ANGP1 (ATOF (RTOS (+ ANGP1 (DTR 360)) 2 5))))
     (IF (AND (>= ANGEO ANGP2) (>= ANGP2 (DTR 0)))
      (SETQ ANGP2 (ATOF (RTOS (+ ANGP2 (DTR 360)) 2 5))))
     (IF (AND (>= ANGEO ANGPA) (>= ANGPA (DTR 0)))
      (SETQ ANGPA (ATOF (RTOS (+ ANGPA (DTR 360)) 2 5))))
    ))
  ;
    (IF (AND (>= ANGP1 ANGSS) (<= ANGP1 ANGEE) (>= ANGP2 ANGSS) (<= ANGP2 ANGEE))
     (PROGN
      (IF (< ANGP1 ANGP2) (SETQ ANGPS ANGP1 INPS INP1 ANGPE ANGP2 INPE INP2))
      (IF (> ANGP1 ANGP2) (SETQ ANGPS ANGP2 INPS INP2 ANGPE ANGP1 INPE INP1))
      (IF (= ANGP1 ANGP2) (SETQ ANGPS ANGP1 INPS INP1 ANGPE NIL   INPE NIL ))
    ))
  ;
    (IF (AND (AND (>= ANGP1 ANGSS) (<= ANGP1 ANGEE))
             (OR  (<  ANGP2 ANGSS) (>  ANGP2 ANGEE)) )
     (SETQ ANGPS ANGP1 INPS INP1 ANGPE NIL INPE NIL)
    )
    (IF (AND (AND (>= ANGP2 ANGSS) (<= ANGP2 ANGEE))
             (OR  (<  ANGP1 ANGSS) (>  ANGP1 ANGEE)) )
     (SETQ ANGPS ANGP2 INPS INP2 ANGPE NIL INPE NIL)
    )
    (IF (AND (OR  (<  ANGP1 ANGSS) (>  ANGP1 ANGEE))
             (OR  (<  ANGP2 ANGSS) (>  ANGP2 ANGEE)) )
     (SETQ ANGPS NIL  INPS NIL  ANGPE NIL INPE NIL)
    )
  ;-----------  TYPE 1  ------------------
    (IF (AND (> DSS R0F) (< DEE R0F))
     (ENTMOD (SUBST (CONS 50 ANGPS) (ASSOC 50 FIGG) FIGG))
    )

    (IF (AND (= DSS R0F) (< DEE R0F) ) (PROGN
     (IF (/= ANGPE NIL)
      (ENTMOD (SUBST (CONS 50 ANGPE) (ASSOC 50 FIGG) FIGG))
     )
     (IF (AND (=  ANGPE NIL) (>= ANGPA ANGSS) (<= ANGPA ANGEE))
      (ENTMOD (SUBST (CONS 50 ANGPS) (ASSOC 50 FIGG) FIGG))
     )
    ))

    (IF (AND (< DSS R0F) (< DEE R0F) (<= ANGPA ANGEE) (>= ANGPA ANGSS)) (PROGN
     (COMMAND "LAYER" "S"  (CDR (ASSOC 8 FIGG)) "")
     (COMMAND "ERASE" PN "")
     (COMMAND "ARC"  "C" CIP1  INPE  PEE )
     (COMMAND "ARC"  "C" CIP1  PSS   INPS)
    ))
  ;-----------  TYPE 2  ------------------
    (IF (AND (> DSS R0F) (= DEE R0F)) (PROGN
     (SETQ ANGPA (ATOF (RTOS (ANGLE CIP1 (POLAR CIP1 (ANGLE CIP1 CIP0) R1))
                             2 5)))
     (IF (AND (> ANGEE (DTR 360)) (>= ANGEO ANGPA) (>= ANGPA (DTR 0)) )
      (SETQ ANGPA (ATOF (RTOS (+ ANGPA (DTR 360)) 2 5)))
     )
     (IF (AND (>= ANGPA ANGSS) (<= ANGPA ANGEE))
      (ENTMOD (SUBST (CONS 50 ANGPS) (ASSOC 50 FIGG) FIGG))
      (COMMAND "ERASE" PN "")
     )
    ))

    (IF (AND (= DSS R0F) (= DEE R0F) (>= ANGPA ANGSS) (<= ANGPA ANGEE) )
     (COMMAND "ERASE" PN "")
    )

    (IF (AND (< DSS R0F) (= DEE R0F) (>= ANGPA ANGSS) (<= ANGPA ANGEE) )
     (ENTMOD (SUBST (CONS 51 ANGPS) (ASSOC 51 FIGG) FIGG))
    )
  ;-----------  TYPE 3  ------------------
    (IF (AND (> DSS R0F) (> DEE R0F) )  (PROGN
     (IF (AND (= ANGPS NIL) (= ANGPE NIL)) (COMMAND "ERASE"  PN ""))
     (IF (AND (/= INPS NIL) (/= INPE NIL))  (PROGN
      (SETQ PN  (SUBST (CONS 50 ANGPS) (ASSOC 50 FIGG) FIGG))
      (SETQ PN  (SUBST (CONS 51 ANGPE) (ASSOC 51 FIGG) PN))
      (ENTMOD PN)
     ))
    ))

    (IF (AND (= DSS R0F) (> DEE R0F))  (PROGN
     (SETQ ANGPA (ANGLE CIP1 (POLAR CIP1 (ANGLE CIP1 CIP0) R1)))
     (IF (AND (> ANGEE (DTR 360)) (>= ANGEO ANGPA) (>= ANGPA (DTR 0)) )
      (SETQ ANGPA (ATOF (RTOS(+ ANGPA (DTR 360)) 2 5)))
     )
     (IF (AND (>= ANGPA ANGSS) (<= ANGPA ANGEE))
      (PROGN
       (IF (=  ANGPE NIL) (ENTMOD (SUBST (CONS 51 ANGPS) (ASSOC 51 FIGG) FIGG)))
       (IF (/= ANGPE NIL) (ENTMOD (SUBST (CONS 51 ANGPE) (ASSOC 51 FIGG) FIGG)))
      )
       (COMMAND "ERASE" PN "")
     )
    ))

    (IF (AND (< DSS R0F) (> DEE R0F))
     (ENTMOD (SUBST (CONS 51 ANGPS) (ASSOC 51 FIGG) FIGG))
    )
  ) (TERPRI);ENDDEFUN OF DA9ARCALFA
