(DEFUN C:DINFORM(/ FORMAT MASST OLDERR DCL_ID QH DD_QUER DD_HOCH DD_DIN DD_MS DD_SF DD_AF AUSGANG HOLEVARS ATTDIA_SAVE ATTREQ_SAVE ORTHOMODE_SAVE DINR)

(DEFUN INS_BLOCK(NAME /)
(IF (OR (TBLSEARCH"BLOCK"NAME) (FINDFILE(STRCAT PROGPATH NAME".DWG")))
  (PROGN 
    (SETVAR"ATTREQ"1)
    (SETVAR"ATTDIA"1)
    (SETVAR"ORTHOMODE"0)
    (COMMAND"._insert"(STRCAT PROGPATH NAME)(GETVAR"LASTPOINT"))
    (COMMAND(CADR(ASSOC DD_MS MASSTI))(CADR(ASSOC DD_MS MASSTI))"0")
    (IF (= DINR 0) 
      (PROGN
        (PROMPT"\nInsertpoint: ")
        (COMMAND"._move""_last"""(GETVAR"LASTPOINT")PAUSE)
      )
    )
    (SETVAR"ORTHOMODE"ORTHOMODE_SAVE)
    (SETVAR"ATTREQ"ATTREQ_SAVE)
    (SETVAR"ATTDIA"ATTDIA_SAVE)
  )
  (PRINC(STRCAT"\nKann Schriftfeld <"NAME"> nicht finden!"))
  )
)

(DEFUN HIDE_DINR(/)
  (IF ( = "0" (GET_TILE"DINR"))
    (PROGN 
      (MODE_TILE"DIN"1)
      (MODE_TILE"HOCH"1)
      (MODE_TILE"QUER"1)
      (MODE_TILE"MS"1)
      (SETQ DINR 0)
    )
    (PROGN 
      (MODE_TILE"DIN"0)
      (MODE_TILE"HOCH"0)
      (MODE_TILE"QUER"0)
      (MODE_TILE"MS"0)
      (SETQ DINR 1)
    )
  )
  DINR
)

(DEFUN HOLEVARS(/)
  (SETQ DD_DIN  (ATOI (GET_TILE"DIN")) 
        DD_HOCH (GET_TILE"HOCH")
        DD_QUER (GET_TILE"QUER")
        DD_MS(ATOI (GET_TILE"MS"))
        DD_SF (GET_TILE"SF")
        DD_AF (GET_TILE"AF")
  )
  (PRIN1)
)

(SETQ OLDERR *ERROR* *ERROR* HAAS-ERR)
(GLOB_VARS 0"\n   Einfgen von DIN-Rahmen")
(IF DEBUG (SETVAR "CMDECHO" 1))
(SETQ ATTDIA_SAVE (GETVAR"ATTDIA")
      ATTREQ_SAVE (GETVAR"ATTREQ")
      ORTHOMODE_SAVE (GETVAR"ORTHOMODE")
)
(SETQ FORMAT (LIST (QUOTE(0"A4"))(QUOTE(1"A3"))(QUOTE(2"A2"))(QUOTE(3"A1"))(QUOTE(4"A0")))
      MASST  (LIST (QUOTE(0"1:50"))(QUOTE(1"1:100"))(QUOTE(2"1:20"))(QUOTE(3"1:25"))(QUOTE(4"1:10"))(QUOTE(5"1:75"))(QUOTE(6"1:200"))(QUOTE(7"1:500"))(QUOTE(8"1:1000")))
      MASSTI (LIST (QUOTE(0 0.50))(QUOTE(1 1.00))(QUOTE(2 0.20))(QUOTE(3 0.25))(QUOTE(4 0.10))(QUOTE(5 0.75))(QUOTE(6 2.00))(QUOTE(7 5.00))(QUOTE(8 10.00)))
)
(SETQ DCL_ID(LOAD_DIALOG(STRCAT HC_LSPPATH"DINFORM.DCL")))
(IF (NOT (NEW_DIALOG"DINFORM"DCL_ID))
  (EXIT)
)
(SETQ DINR 1) 
(ACTION_TILE"DINR"" 
  (setq dinr (hide_dinr))"
)
(ACTION_TILE"cancel""
  (done_dialog 0)"
)
(ACTION_TILE"accept""
  (holevars)(done_dialog 1)"
)
(SETQ AUSGANG(START_DIALOG))

(IF(> AUSGANG 0)
  (PROGN
    (IF (= DINR 1)
      (PROGN
        (PROMPT"\n DIN-Format: ")
        (PRINC (CADR (ASSOC DD_DIN FORMAT)))
        (PROMPT"\n     Format: ")
          (IF(="1"DD_QUER)
            (PRINC"Querformat")
            (PRINC"Hochformat")
          )
          (PROMPT"\n    Maástab: ")
          (PRINC (CADR (ASSOC DD_MS MASST)))
          (PROMPT"\nSchriftkopf: ")
            (IF(="1"DD_SF)
              (PRINC"JA")
              (PRINC"NEIN")
            )
            (PROMPT"\nŽnderungsk.: ")
            (IF(="1"DD_AF)
              (PRINC"JA")
              (PRINC"NEIN")
            )
            (IF(="1"DD_QUER)
              (SETQ QH"Q")
              (SETQ QH"H")
            )
            (SETQ NAME (STRCAT "HAAS" (CADR(ASSOC DD_DIN FORMAT))QH))
            (PRINC(STRCAT"\n  Blockname: "NAME))
            (IF ( OR (TBLSEARCH"BLOCK"NAME) (FINDFILE(STRCAT PROGPATH NAME".dwg")))
              (PROGN 
                (SETVAR"ORTHOMODE"0)
                (COMMAND"_insert"(STRCAT PROGPATH NAME)"0,0")
                (COMMAND(CADR(ASSOC DD_MS MASSTI))(CADR(ASSOC DD_MS MASSTI))"0")
                (SETQ LEAW(SSADD))
                (SETQ LEAW(SSADD(ENTLAST)))
                (PROMPT"\nEinfgepunkt: ")
                (COMMAND"_move"LEAW"""0,0"PAUSE)
                (SETVAR"ORTHOMODE"ORTHOMODE_SAVE)
                (PROMPT"\n\nBitte Plotbereich beachten => evtl. kleiner als eingefgter Rahmen!"))
                (PRINC(STRCAT"\nKein DIN-Rahmen <"NAME"> gefunden.")
              )
    )
  )
)
(IF(="1"DD_SF)
  (INS_BLOCK"HAASSCHF")
)
(IF(="1"DD_AF)
  (INS_BLOCK"HAASAEND")
)
)
(PROMPT"\nDialog abgebrochen")
)
(MENUCMD"S=S")
(MENUCMD"S=*")
(PRINC)
(GLOB_VARS 1"")
(SETQ *ERROR* OLDERR)
(PRINC)
)
(PRIN1)
