;------------------------------------------------------------------------;
; DIN-Blatt einfgen                                                     ;
;------------------------------------------------------------------------;
; AW 05.12.93                                                            ;
;------------------------------------------------------------------------;
(defun Dbox (/ Dat)
  (setq Dat (load_dialog (strcat lw "/acadsst/menu/DINFORM.DCL")))
  (if (not (new_dialog "DINFORM" Dat)) (exit))
  (action_tile "accept" "(SetPara) (done_dialog)")
  (action_tile "cancel" "(exit) (done_dialog)")
  (start_dialog)
  (unload_dialog Dat)
)

(defun SetPara ()
  (setq DD_DIN  (get_tile "DIN"))
  (setq DD_MS   (get_tile "MS"))  
  (setq DD_SF   (get_tile "SF"))
  (setq DD_QUER (get_tile "QUER"))
  ;------ Format definieren-----------
  (if (= DD_DIN "0")
    (setq BL-NAME "A0")
  )
  (if (= DD_DIN "1")
    (setq BL-NAME "A1")
  )
  (if (= DD_DIN "2")
    (setq BL-NAME "A2")
  )
  (if (= DD_DIN "3")
    (setq BL-NAME "A3")
  )
  (if (= DD_DIN "4")
    (progn
      (if (= DD_QUER "1")
        (setq BL-NAME "A4Q")
        (setq BL-NAME "A4H")
      )
    )
  )
  (setq BL-NAME (strcat lw "/acadsst/koepfe/" BL-NAME))
  ;------------------------------------------------------
  ; Maástab definieren
  (if (= DD_MS "0")
    (progn
      (setq FAKTOR "1")
      (setq FAKTOR1 "0.01")
    )
  )
  (if (= DD_MS "1")  ; 1:10
    (progn
      (setq FAKTOR "10")
      (setq FAKTOR1 "0.1")
    )
  )
  (if (= DD_MS "2")  ; 1:20
    (progn
      (setq FAKTOR "20")
      (setq FAKTOR1 "0,2")
    )
  )
  (if (= DD_MS "3")  ; 1:25
    (progn
      (setq FAKTOR "25")
      (setq FAKTOR1 "0.25")
    )
  )
  (if (= DD_MS "4")  ; 1:50
    (progn
      (setq FAKTOR "50")
      (setq FAKTOR1 "0.5")
    )
  )
  (if (= DD_MS "5")  ; 1:75
    (progn
      (setq FAKTOR "75")
      (setq FAKTOR1 "0.75")
    )
  )
  (if (= DD_MS "6")  ; 1:100
    (progn
      (setq FAKTOR  "100")
      (setq FAKTOR1 "1")
    )
  )
  (if (= DD_MS "7")  ; 1:200
    (progn
      (setq FAKTOR "200")
      (setq FAKTOR1 "2")
    )
  )
  (if (= DD_MS "8")  ; 1:500
    (progn
      (setq FAKTOR "500")
      (setq FAKTOR1 "5")
    )
  )
  (if (= DD_MS "9")  ; 1:1000
    (progn
      (setq FAKTOR "1000")
      (setq FAKTOR1 "10")
    )
  )
)
(defun datain ()  
  (setq AUSWAHL-SATZ nil)
)
(defun geometrie()
  (command "_layer" "_m" "RAHMEN" "_c" "7" "" "")
  (setq P0  (getpoint "\nPick BORDER Insertion-Point (LOWER-LEFT): "))
  (command "_insert" BL-NAME P0 FAKTOR "" "0")
  (if (= DD_SF "1")
    (progn
      (setq P1  (getpoint "\nPick HEADER Insertion-Point (LOWER-RIGHT): "))
      (command "_insert" (strcat lw "/acadsst/koepfe/" "kopf11") P1 FAKTOR1 "" "0")
    )
  )
)

;------------------------------------------------------------------------------
(defun c:DINFORM(/ DIN QUER HOCH MS SF FAKTOR BL-NAME) 
  (setvar "limcheck" 0)
  (setvar "CMDECHO" 0)
  (setvar "BLIPMODE" 0)
  (prompt "**** INSERT DRAWING BORDER & HEADER *******")
  (Dbox)
  (prompt "")
  (datain)
  (geometrie)
)
