(defun C:print_to_png_area (/ sk krest-dist max-x max-y min-x min-y point1 point2 temp-y temp-x flag cur-str-temp-x list-coor-krest str-list 1/m file-name
			    list-all-coor-krest list-all-points list-str-for-archaeosys new-list-all-points new-list-points-b-l
			    new-point putch-text-file-coord temp-list ss list-coor-krest-clear pline spisok pach-folder)
  ;
  (setq sk (getvar "CANNOSCALEVALUE"))
  (setq krest-dist (/ 100.0 sk)); сторона квадрата "тайла"
  (initget 1)(setq pline (car (entsel "\nВыбери полилинию ограничивающую чертеж: ")))
  (cond
    ((eq pline nil)
     (alert "Ничего не выбрано!"))
    ((not(eq (cdr(assoc 0 (entget pline))) "LWPOLYLINE"))
     (alert "Выбрана не 2D полилиния!"))
    ((eq (cdr(assoc 0 (entget pline))) "LWPOLYLINE")
     (setq spisok (extract_coord_lwpolyline (entget pline)))
     (setq max-x (apply 'max (mapcar 'car spisok)))
     (setq min-x (- (apply 'min (mapcar 'car spisok)) krest-dist))
     (setq max-y (+ (apply 'max (mapcar 'cadr spisok)) krest-dist))
     (setq min-y (apply 'min (mapcar 'cadr spisok)))
     
     (setq temp-y(*(atof(rtos (/ min-y krest-dist) 2 0))krest-dist))
     (if (< temp-y min-y) (setq temp-y (+ temp-y krest-dist)))
     (if (< temp-y max-y)
       (progn
	 (setq temp-x(*(atof(rtos (/ min-x krest-dist) 2 0))krest-dist))
	 (if (< temp-x min-x) (setq temp-x (+ temp-x krest-dist)))
	 (if (< temp-x max-x)
	   (progn
	     (setq str-list (list temp-y))
	     (while (not flag)
	       (setq temp-y (+ temp-y krest-dist))
	       (if (< temp-y max-y) (setq str-list (append str-list (list temp-y))) (setq flag T))
	       )
	     
	     (foreach y str-list
	       (setq cur-str-temp-x temp-x)
	       (setq flag nil)
	       (setq list-coor-krest (append list-coor-krest (list (list cur-str-temp-x y))))
	       (while (not flag)
		 (setq cur-str-temp-x (+ cur-str-temp-x krest-dist))
		 (if (< cur-str-temp-x max-x) (setq list-coor-krest (append list-coor-krest (list(list cur-str-temp-x y)))) (setq flag T))
		 )
	       ); список всех координат крестов (верхних левых углов квадратов)
	     (foreach x list-coor-krest
	       (if (or (analisis-point-in-contur spisok x)
		       (analisis-point-in-contur spisok (mapcar '+ x (list krest-dist 0.0 )))
		       (analisis-point-in-contur spisok (mapcar '+ x (list krest-dist (* krest-dist -1.0))))
		       (analisis-point-in-contur spisok (mapcar '+ x (list 0.0 (* krest-dist -1.0)))))
		 (setq list-coor-krest-clear (append list-coor-krest-clear (list x))))
	       ); список координат крестов попадающих в полилинию (верхних левых углов квадратов)
	     (setq list-coor-krest list-coor-krest-clear)
	     
	     (setq convert-sys-property(dialog-print_to_png_area))
	     
	     (setq pach-folder (strcat (getvar "DWGPREFIX")"map"))
	     (folder-p-and-create pach-folder)
	     (foreach x list-coor-krest
	       (print_to_png pach-folder x krest-dist)
	       )
	     
	     (foreach x list-coor-krest
	       (create-map-file pach-folder x krest-dist 1000 convert-sys-property)
	       )
	     
	     )
	      )
	    )
	  (alert "В указаную область не попадает ни одно перекрестье сетки в данном масштабе.")
	  )
	)
      )
  (princ)
  )