(defun C:draw_coord_table_be_pick_point ; чертит таблицу координат указываемых точек
       (/ num net_podpysi ins_podpysi est_podpysi sel_return sel_new dcl_id
	t0 t1 table_obj num_row vinoska vla_vinoska point_list osn list_points
	pt_array mleader_obj *ERROR*)
(geo_tools-help "draw_coord_table_be_pick_point")
  (load_global_variable)
  (create-table-style);создает стиль таблиц каталога координат
  (create-mleader-style "Подписи");создает стиль мвыносок
  (defun *ERROR* (msg)
    (princ)
    )
  (setq num 1)
  (setq net_podpysi 1)
  (setq ins_podpysi 0)
  (setq est_podpysi 0)
  (setq sel_return 0)
  (setq sel_new 1)
  (setq dcl_id (geo-tools-load-dialog "tab_koor"))
  (new_dialog "tab_koor" dcl_id)
  (action_tile "new" "(mode_tile \"n\" 0)(setq sel_new 1)(setq sel_return 0)")
  (action_tile "return" "(mode_tile \"n\" 1)(setq sel_return 1)(setq sel_new 0)")
  (action_tile "net_podpysi" "(setq net_podpysi 1)(setq ins_podpysi 0)(setq est_podpysi 0)")
  (action_tile "ins_podpysi" "(setq net_podpysi 0)(setq ins_podpysi 1)(setq est_podpysi 0)")
  (action_tile "est_podpysi" "(setq net_podpysi 0)(setq ins_podpysi 0)(setq est_podpysi 1)")
  (action_tile "n" "(setq num (get_tile \"n\"))")
  (if (eq (start_dialog) 0) (progn (unload_dialog dcl_id)(exit))(unload_dialog dcl_id))
  (if
    (not (or (eq (type num) 'INT)(eq (type num) 'REAL)))
    (setq num (atof num))
    )
  (if (eq sel_new 1)
    (progn
      (initget 1)(setq t0 (getpoint "\nУкажи точку вставки таблицы координат: "))

      (setq table_obj (vla-AddTable model_spece (vlax-3D-point t0) 2 4 12 20))
      (vla-put-StyleName table_obj "Координаты")
      (vla-SetColumnWidth table_obj 0 8)
      (vla-SetText table_obj 1 0 "№\nп/п")
      (vla-SetCellAlignment table_obj 1 0 acMiddleCenter)
      (vla-SetText table_obj 1 1 " Наимено-\n вание")
      (vla-SetCellAlignment table_obj 1 1 acMiddleLeft)
      (vla-SetText table_obj 1 2 "X")
      (vla-SetCellAlignment table_obj 1 2 acMiddleCenter)
      (vla-SetCellTextHeight table_obj 1 2 2.8)
      (vla-SetText table_obj 1 3 "Y")
      (vla-SetCellAlignment table_obj 1 3 acMiddleCenter)
      (vla-SetCellTextHeight table_obj 1 3 2.8)
      (setq num_row 2)
      )
    (progn
      (initget 1)(setq table_obj(vlax-ename->vla-object (car (entsel"\nВыбери существующую таблицу координат: "))))
      (if (/= (cdr (assoc 0 (entget(vlax-vla-object->ename table_obj))))"ACAD_TABLE")
	(alert "Выбрана не таблица!"))
      (setq num_row (vla-get-rows table_obj))
      (setq num 2)
      )
    )
  (if (eq est_podpysi 1)
    (progn
      (initget)(setq vinoska(car (entsel "\nВыбери выноску: ")))
      (if vinoska
	(progn
	  (setq vla_vinoska(vlax-ename->vla-object vinoska))
	  (setq point_list (vlax-safearray->list(vlax-variant-value(vla-GetLeaderLineVertices vla_vinoska 0))))
	  (setq t1 (list (car point_list) (cadr point_list)))
	  )(exit))
      )
    (progn
      (initget)(setq t1(getpoint "\nУкажи точку: ")))
    )
  (while (not (eq t1 nil))
    (if (eq est_podpysi 1)
      (if (eq (vla-get-ContentBlockName vla_vinoska) "")
	(setq d (vla-get-TextString vla_vinoska))
	(setq d (strcat"т."(cadr(extract_302 (entget vinoska))))))
      (progn
	(initget 1)(setq d (getstring T "\nЧто это?: "))
	(if (eq ins_podpysi 1)
	  (progn
	    (setq osn (getvar "OSMODE"))
	    (setvar "OSMODE" 0)
	    (initget)(setq tt(getpoint "\nУкажи точку куда положить подпись?<ENTER - пропустить эту подпись>: "))
	    (setvar "OSMODE" osn)
	    ))
	(if(and(eq ins_podpysi 1)(not (null tt)))
	  (progn
	    (setq list_points (list t1 tt))
	    (setq pt_array (convert_coords_list_from_safearray_mleader list_points))
	    (setq mleader_obj (vla-addmleader model_spece pt_array 0))
	    (vla-put-StyleName mleader_obj "Подписи")
	    (vla-put-textstring mleader_obj d)
	    ))
	)
      )
    (vla-InsertRows table_obj (1+ num_row) 8 1)
    (vla-SetText table_obj num_row 0
      (cond
	((= num 1)"=1")
	((> num_row 2.0)
	 (strcat "=A"(rtos num_row 2 0)"+1"))
	(t
	 (strcat "="(rtos num 2 0)))
	)
      )
    (vla-SetCellAlignment table_obj num_row 0 acMiddleCenter)
    (vla-SetText table_obj num_row 1 d)
    (vla-SetCellAlignment table_obj num_row 1 acMiddleLeft)
    (vla-SetText table_obj num_row 2 (rtos (nth 1 t1) 2 2))
    (vla-SetCellAlignment table_obj num_row 2 acMiddleCenter)
    (vla-SetCellTextHeight table_obj num_row 2 2.8)
    (vla-SetText table_obj num_row 3 (rtos (nth 0 t1) 2 2))
    (vla-SetCellAlignment table_obj num_row 3 acMiddleCenter)
    (vla-SetCellTextHeight table_obj num_row 3 2.8)
    (setq num_row (1+ num_row))
    (setq num (1+ num))
    (if (eq est_podpysi 1)
      (progn
	(initget)(setq vinoska(car (entsel "\nВыбери выноску: ")))
	(if vinoska
	  (progn
	    (setq vla_vinoska(vlax-ename->vla-object vinoska))
	    (setq point_list (vlax-safearray->list(vlax-variant-value(vla-GetLeaderLineVertices vla_vinoska 0))))
	    (setq t1 (list (car point_list) (cadr point_list)))
	    )(exit))
	)
      (progn
	(initget)(setq t1(getpoint "\nУкажи точку: ")))
      )
    )
  (princ)
  )
