(defun ini_dia_b()
  (if btl_num
    (progn
      (setq nam1  (nth 2 btl_1)
	    sca1  (nth 3 btl_1)
	    filn1 (nth 4 btl_1)
	    uni1  (nth 5 btl_1)
	    num1  (nth 6 btl_1)
	    shf1  (nth 7 btl_1)
	    sh1   (nth 8 btl_1)
	    vers1 (nth 9 btl_1)
	    mat1  (nth 10 btl_1)
	    dat1  (nth 11 btl_1)
	    shr1  (nth 12 btl_1)
	    fileno1 (nth 13 btl_1)
	    machine1 (nth 14 btl_1)
      )
      (setq mat_n  (if (xh_get mat1 (lib_b 1))
	             (xh_get mat1 (lib_b 1))
		     -1)
      )
      (setq sc_n   (if (xh_get sca1 (lib_b 3))
		     (xh_get sca1 (lib_b 3))
		     4)
      )
      (setq unit_n (if (xh_get uni1 (lib_b 4))
		     (xh_get uni1 (lib_b 4))
		     0)
      )
      (setq ver_n  (if (xh_get vers1 (lib_b 5))
		     (xh_get vers1 (lib_b 5))
		     0)
      (setq MACHINE_n  (if (xh_get machine1 (lib_b 6))
		     (xh_get MACHINE1 (lib_6 5))
		     1)
      )
    )
    (progn
      (setq mat_n  0
	    sc_n  4
	    unit_n 0
	    ver_n  0
	    MACHINE_N 1	
      )
    )

  )
  (ini_list "B_MAT_VAL" (lib_b 1))
  (ini_list "B_SC" (lib_b 3))
  (ini_list "B_UNIT" (lib_b 4))
  (ini_list "B_VER" (lib_b 5))
  (ini_list "B_MACHINE" (lib_b 6))
  (set_tile "B_SC" (itoa sc_n))
  (set_tile "B_UNIT" (itoa unit_n))
  (set_tile "B_VER" (itoa ver_n))
  (if (not btl_1)
    (progn
      (set_tile "B_MAT" (nth mat_n (lib_b 1)))
      (set_tile "B_SHR" (nth mat_n (lib_b 2)))
      (setq date_val (itoa (fix (getvar "cdate"))))
      (set_tile "B_DATE" (strcat (substr date_val 1 4) 
				 "-" (substr date_val 5 2) 
				 "-" (substr date_val 7 2)))
      (set_tile "B_FILE" (strcat (lxy_trim (getvar "loginname")) "\\" 
				 (getvar "dwgprefix") 
				 (getvar "dwgname")))
      ;(setq dwg_name (strcase (getvar "dwgname")))
	(setq name_len (strlen (getvar "dwgname")))
	(set_tile "B_FILENO" (strcat "EDA-DMD-" (substr (getvar "dwgname") 1 (- name_len 4))))

      (set_tile "B_SHF" "1")
      (set_tile "B_SH" "1")
    )
    (progn
      (if (= -1 mat_n)
	(progn
	  (set_tile "B_MAT" mat1)
	  (set_tile "B_SHR" shr1)
	)
        (progn
	  (set_tile "B_MAT" (nth mat_n (lib_b 1)))
	  (set_tile "B_SHR" (nth mat_n (lib_b 2)))
	)
      )
      (set_tile "B_NAME" nam1)
      (set_tile "B_SHF" shf1)
      (set_tile "B_SH"  sh1)
      (set_tile "B_DATE" dat1)
      (set_tile "B_FILE" filn1)
      (set_title "B_FILENO" FILENO1)
      (set_title "B_MACHINE" MACHINE1) 		
      (set_tile "B_NUM" num1)
    )
  )
)