(defun C:insert_file_dxf_by_numenklature2000 (/ file-name list_files insert-point ln nn obj rastr-patch vektor-patch file nobor vla_item)
  ; вставка .dxf файла вектора (МСК-Саратов М1:2000) по номенклатуре
  
  (setq rastr-patch "d:\\002k\\tif"
	vektor-patch "d:\\002k\\dxf")
  
  (setq list_files (file_find_be_extension rastr-patch "tif"))
  (setq ln (itoa (length list_files)))
  (setq nn 0)
  (foreach file list_files
;;;    (setq file (car list_files))
    (setq file-name (vl-filename-base file))
    (create-or-sel-layer (strcat "_" file-name))
    (setq insert-point (get-point-by_numenklature2000 file-name))
    (setq messege (strcat(itoa nn)"/"ln))
    (grtext -1 messege)
    (name-file-to-messege messege)
    (command "-image" "_attach" file insert-point "1" "0")
    (setq obj (vlax-ename->vla-object (entlast)))
    (vla-put-ImageHeight obj 1000.0)
    (vla-put-ImageWidth obj 1000.0)
    (vla-put-color obj 7)
    (command "_insert" (strcat vektor-patch "\\" file-name ".dxf") insert-point (*(/ 300.0(min (vla-get-Width obj)(vla-get-Height obj)))1000.0) "" "")
    (command "_explode" (entlast))
    (if(tblobjname "block" file-name)(command "_-purge" "Б" file-name "Н"))
    (setq nobor (ssget "_X" (list (cons 0 "LWPOLYLINE")(cons 8 "0"))))
    (foreach item (convert_ss_to_list nobor)
      (setq vla_item (vlax-ename->vla-object item))
      (vla-put-color vla_item 256)
      (vla-put-layer vla_item (strcat "_" file-name))
      )
    (setq nobor nil)
    (create-or-sel-layer "0")
    (command "-слой" "_off" (strcat "_" file-name) "")
    (setq nn (1+ nn))
    )
  (grtext -1 "")
  (delete-name-file-to-messege)
  (command "_qsave")
  (princ)
  )


;;;(vla-get-color(vlax-ename->vla-object (car(entsel))))