(defun properties_punkts_of_katalog (path / dcl_id list-block-name o-doc type-puncts types)
  (if(setq o-doc(XML-Get-XMLObject path))
    (progn
      (setq types(XML-Get-Child (XML-Get-Child o-doc nil "properties") nil "type-puncts"))
      (setq type-puncts(XML-Get-Children types nil))
      (setq list-block-name(add-mggt-punct-types-in-drawning))
      (setq dcl_id (geo-tools-load-dialog "d_properties_punkts_of_katalog"))
      (new_dialog "d_properties_punkts_of_katalog" dcl_id)
      (set-name-block-list list-block-name)
      (set-list-type-puncts type-puncts 0)
      (set-type-and-name-block type-puncts list-block-name 0)
      (action_tile "list-punct"
	(vl-prin1-to-string
	  '(progn
	    (setq num-list-punct (atoi $value))
	    (set-list-type-puncts type-puncts num-list-punct)
	    (set-type-and-name-block type-puncts list-block-name num-list-punct)
	    )))
      (action_tile "name"
	(vl-prin1-to-string
	  '(progn
	    (XML-Put-Attribute (vlax-get-property type-puncts 'item num-list-punct) "name" (get_tile "name"))
	    (set-list-type-puncts type-puncts num-list-punct)
	    )))
      (action_tile "block-name"
	(vl-prin1-to-string
	  '(progn
	    (XML-Put-Attribute (vlax-get-property type-puncts 'item num-list-punct) "block-name" (nth(atoi $value)list-block-name))
	    (set-list-type-puncts type-puncts num-list-punct)
	    )))
      (action_tile "new"
	(vl-prin1-to-string
	  '(progn
	    (setq type-punct (XML-Add-Child types "type-punct"))
	    (XML-Put-Attribute type-punct "name" "Новый тип пункта")
	    (XML-Put-Attribute type-punct "block-name" "МГГТ тип знака не определен")
	    (setq num-list-punct (1-(vlax-get-property type-puncts 'length)))
	    (set-list-type-puncts type-puncts num-list-punct)
	    (set-type-and-name-block type-puncts list-block-name num-list-punct)
	    )))
      (action_tile "del"
	(vl-prin1-to-string
	  '(progn
	    (XML-Remove-Child (vlax-get-property type-puncts 'item num-list-punct))
	    (if (= num-list-punct(vlax-get-property type-puncts 'length))
	     (setq num-list-punct (1-(vlax-get-property type-puncts 'length))))
	    (set-list-type-puncts type-puncts num-list-punct)
	    (set-type-and-name-block type-puncts list-block-name num-list-punct)
	    )))
      (action_tile "save"(vl-prin1-to-string'(progn(done_dialog 2))))
      (if (eq (start_dialog) 2)
	(XML-Save o-doc)
	)
      (unload_dialog dcl_id)
      (vlax-release-object o-doc)
      )
    (alert "Файл каталога координат пунктов не обнаружен!")
    )
  (princ)
  )

(defun set-list-type-puncts (type-puncts num-list-punct / n punct-type)
  (start_list "list-punct")
  (setq n 0)
  (while (setq punct-type (vlax-get-property type-puncts 'item n))
    (add_list (strcat (XML-Get-Attribute punct-type "name" "") " ["(XML-Get-Attribute punct-type "block-name" "")"]"))
    (setq n (1+ n))
    )
  (end_list)
  (set_tile "list-punct" (itoa num-list-punct))
  )

(defun set-name-block-list (list-block-name / list-block-name)
  (start_list "block-name")
  (mapcar 'add_list list-block-name)
  (end_list)
  list-block-name
  )

(defun set-type-and-name-block (type-puncts list-block-name num-list-punct / n punct-type LIST-BLOCK-NAME NUMBER)
  (setq punct-type (vlax-get-property type-puncts 'item num-list-punct))
  (set_tile "name"(XML-Get-Attribute punct-type "name" ""))
  (if (not(setq number (analysis-number-item-in-list (XML-Get-Attribute punct-type "block-name" "")list-block-name)))
    (setq number(analysis-number-item-in-list "МГГТ тип знака не определен" list-block-name)))
  (set_tile "block-name" (itoa number))
  )

(defun get-list-block-name-mggt ( / BLOCKS N NAME RESULT)
  (setq blocks (vla-get-Blocks(vla-get-ActiveDocument(vlax-get-acad-object))))
  (setq n 0)
  (repeat (vla-get-Count blocks)
    (setq name(vla-get-name(vla-item blocks n)))
    (if (vl-string-search "МГГТ " name)
      (setq result (append result (list name)))
      )
    (setq n (1+ n))
    )
  result
  )

;;;(defun refreh-dialog-properties-punkts-of-katalog (num-list-punct type-puncts /)
;;;  (if (not (setq list-block-name(get-list-block-name-mggt)))
;;;    (progn
;;;      (setvar "nomutt" 1)
;;;      (command "_insert" "МГГТ блоки пунктов" (command))
;;;      (command "_-purge" "_b" "МГГТ блоки пунктов" "_n")
;;;      (setvar "nomutt" 0)
;;;      (setq list-block-name(get-list-block-name-mggt))
;;;      )
;;;    )
;;;  (start_list "list-punct")
;;;  (setq n 0)
;;;  (while (setq punct-type (vlax-get-property type-puncts 'item n))
;;;    (add_list (strcat (XML-Get-Attribute punct-type "name" "") " ["(XML-Get-Attribute punct-type "block-name" "")"]"))
;;;    (setq n (1+ n))
;;;    )
;;;  (end_list)
;;;  (set_tile "list-punct" (itoa num-list-punct))
;;;  (start_list "block-name")
;;;  (mapcar 'add_list list-block-name)
;;;  (end_list)
;;;  (setq punct-type (vlax-get-property type-puncts 'item num-list-punct))
;;;  (set_tile "name"(XML-Get-Attribute punct-type "name" ""))
;;;  (if (not(setq number (analysis-number-item-in-list (XML-Get-Attribute punct-type "block-name" "")list-block-name)))
;;;    (setq number(analysis-number-item-in-list "МГГТ тип знака не определен" list-block-name)))
;;;  (set_tile "block-name" (itoa number))
;;;  )


(defun add-mggt-punct-types-in-drawning ( / *error* blocks list-block-name)
  (defun *error* (msg)
    (setvar "NOMUTT" 0)
    (princ)
    )
  (if (not (setq list-block-name(get-list-block-name-mggt)))
    (progn
      (setvar "nomutt" 1)
      (command "_insert" "МГГТ блоки пунктов" (command))
      (command "_-purge" "_b" "МГГТ блоки пунктов" "_n")
      (setvar "nomutt" 0)
      (setq list-block-name(get-list-block-name-mggt))
      (setq Blocks(vla-get-Blocks active_document))
      (foreach x list-block-name
	(add-attributs-to-mggt-punkt (vla-Item Blocks x))
	)
      )
    )
  list-block-name
  )

(defun add-attributs-to-mggt-punkt (block /)
  (foreach x (list (list "NAME" (list 2.5 3 0) "Имя, номер знака")
		   (list "TYPE" (list 2.5 0 0) "Тип знака")
		   (list "N" (list 2.5 -3 0)"Северная координата")
		   (list "E" (list 2.5 -6 0)"Восточная координата")
		   (list "Z" (list 2.5 -9 0)"Отметка")
		   (list "ADDRESS" (list 2.5 -12 0)"Местоположение, адрес")
		   (list "COMMENT" (list 2.5 -15 0)"Коментарий")
		   (list "YEAR" (list 2.5 -18 0)"Год получения данных"))
    (draw-attribute-vla-by-list-property
      (list(cons "spece" block)
	   (cons "Height" 2.0)
	   (cons "Layer" "0")
	   (cons "Color" 0)
	   (cons "Lineweight" -2)
	   (cons "Mode" acAttributeModeNormal)
	   (cons "Linetype" "Continuous")
	   (cons "PromptString" (caddr x))
	   (cons "InsertionPoint" (cadr x))
	   (cons "TagString" (car x))
	   (cons "TextString" "")
	   (cons "Alignment" 9)
	   (cons "StyleName" (getvar "TEXTSTYLE"))
	   )))
  )