(defun C:profile_add_new_ii_skv_be_profile ( /
					   block-obj block-profile-obj buffer-zone curent-profile
					   elevation horizontal-scale insert-point
					   lightweightpolyline point reference-level
					   scale-coefficient start-point trace-2dpline vertical-scale profile-mode plan-point HEIGHT-TEXT NUMBER X EGWL-point)
  (load_global_variable)
  (geo_tools-help "profile_add_new_point_be_profile")
  (setq profile-mode (vlax-ldata-get "geo_tools_dictionary" "profile-mode"))
  (if(if (not profile-mode)(profile-seleckt-curent-mode)T)
    (if (=(vlax-ldata-get "geo_tools_dictionary" "profile-mode")1)
      (progn
	(setq curent-profile(vlax-ldata-get "geo_tools_dictionary" "curent-profile"))
	(if curent-profile
	  (if (vlax-erased-p (cdr curent-profile))
	    (alert "Ошибка! Текущий профиль был удален.\nВыбрать другой текущий профиль можно с помощью команды \"Выбрать текущий профиль\"")
	    (progn
	      
	      (princ (strcat"\nТекущий профиль: "(car curent-profile)))
	  (setq 3Dsurface (car (entsel "\nВыберите поверхность: ")))
	      (if (eq (cdr(assoc 0 (entget 3Dsurface))) "AECC_TIN_SURFACE")
		
		(while (setq elevation (get-ii-skv-be-plan 3Dsurface))
		  (if (setq point (car elevation))
		    (progn
		      (setq block-profile-obj (cdr curent-profile))
		      (setq trace-2Dpline (trace-create-2Dpline-by-block-profile block-profile-obj))
		      (setq block-obj (cdr(assoc "block"(vlax-ldata-get block-profile-obj"obj-list"))))
		      (setq vertical-scale (vlax-ldata-get block-profile-obj"vertical-scale"))
		      (setq horizontal-scale (vlax-ldata-get block-profile-obj"horizontal-scale"))
		      (setq scale-coefficient (/ 1.0 (/ 1000.0 horizontal-scale)))
		      (setq height-text (*(atof(nth 9 (vlax-ldata-get block-profile-obj"profile-parameters")))scale-coefficient))
		      (setq reference-level (vlax-ldata-get block-profile-obj"reference-level"))
		      (setq buffer-zone(*(atof(nth 3 (vlax-ldata-get block-profile-obj"profile-parameters")))scale-coefficient))
		      (setq start-point(mapcar'+ (vlax-safearray->list(vlax-variant-value(vla-get-InsertionPoint block-profile-obj)))(list buffer-zone 0)))
		      (setq plan-point (vlax-curve-getDistAtPoint trace-2Dpline (vlax-curve-getClosestPointTo trace-2Dpline (list (car point)(cadr point)0))))
		      (vla-erase trace-2Dpline)
		      ;| раньше необходимость строить линейку определялось по присутствии в obj-list раздела ruler-list
теперь для этого есть флаг ruler. Здесь предпологается использование предидущего варианта старого профиля
удаляется (если есть) ruler-list и вместо него ставится ruler=1 |;
		      
		      (if (/= (cdr(assoc "ruler-list"(vlax-ldata-get block-profile-obj"obj-list")))nil)
			(progn
			  (vlax-ldata-put block-profile-obj"ruler" 1)
			  (if(setq number (analysis-number-item-in-list
					    (assoc "ruler-list"(vlax-ldata-get block-profile-obj"obj-list"))
					    (vlax-ldata-get block-profile-obj"obj-list")))
			    (vlax-ldata-put block-profile-obj"obj-list"
			      (edit-list-del-item-by-number number(vlax-ldata-get block-profile-obj"obj-list")))
			    )
			  )
			)
		      (vla-StartUndoMark active_document)
		      (if (/=(vlax-ldata-get block-profile-obj"ruler")1)
			(progn
			  (profile-draw-ruler-in-basement block-profile-obj (convert-list-elevation2point-list(cadr elevation)))
			  (vlax-ldata-put block-profile-obj"ruler" 1)
			  )
			)
		      (setq reference-level (vlax-ldata-get block-profile-obj"reference-level"))
		      
		      (setq x (nth 2 (car elevation)))
		      
		      (setq insert-point
			     (mapcar '+ start-point
				     (list
				       plan-point
				       (/(- x reference-level)(/ (* vertical-scale (/ 1000.0 horizontal-scale)) 1000.0))
				       )))
		      (setq down-point
			     (mapcar '+ start-point
				     (list
				       plan-point
				       (/(- (- x (atof(cdr(assoc "HEIGHT" elevation)))) reference-level)(/ (* vertical-scale (/ 1000.0 horizontal-scale)) 1000.0))
				       )))
		      (if (/= (cdr(assoc "EGWL" elevation)) "")
			(progn
			  (setq EGWL-point
			     (mapcar '+ start-point
				     (list
				       plan-point
				       (/(- (- x (atof(cdr(assoc "EGWL" elevation)))) reference-level)(/ (* vertical-scale (/ 1000.0 horizontal-scale)) 1000.0))
				       )))
			  (draw-lwpolyline-vla-by-list-property
			    (list(cons "spece" (if (eq (getvar "CTAB")"Model")model_spece paper_spece))
				 (cons "Coordinates" (list
						       (mapcar '+ EGWL-point (list (* -0.5 scale-coefficient) 0))
						       (mapcar '+ EGWL-point (list (* 0.5 scale-coefficient) 0))
						       ))
				 (cons "Color" 5)
				 (cons "Linetype" "Continuous")
				 (cons "Closed" -1)
				 ))
			  )
			)
			
		      
		      (setq LightWeightPolyline (vla-addLightWeightPolyline model_spece
						  (convert-list-points-to-lwpolyline-safearray (list (mapcar '+ insert-point (list (* -0.5 scale-coefficient) 0))
												     insert-point
												     (mapcar '+ insert-point (list (* 0.5 scale-coefficient) 0))
												     (mapcar '+ down-point (list (* 0.5 scale-coefficient) 0))
												     (mapcar '+ down-point (list (* -0.5 scale-coefficient) 0))
												     ))))
		      (vla-put-Linetype LightWeightPolyline "Continuous")
		      (vla-put-Closed LightWeightPolyline -1)
		      
		      
		      (draw-text-vla-by-list-property
			(list
			  (cons "spece" (if (eq (getvar "CTAB")"Model")model_spece paper_spece))
			  (cons "TextString" (cdr(assoc "NUMBER" elevation)))
			  (cons "InsertionPoint" insert-point)
			  (cons "Height" height-text)
			  (cons "Rotation" 0)
			  (cons "Alignment" 12)
			  ))
		      
		      
		      
		      (vla-EndUndoMark active_document)
		      )
		    )
		  
		  )
		)
	      )
	    )
	  (alert "Ошибка! Текущий профиль не определен.\nВыбрать текущий профиль можно с помощью команды \"Выбрать текущий профиль\"")
	  )
	)
      (alert "Данная команда не работает в режиме \"старый профиль\"!")
      )
    )
  (princ)
  )

(defun get-ii-skv-be-plan (3Dsurface / flag insert-point list-all-atts obj temp z)
  ;запрос объекта с отметкой
  (load_global_variable)
  (setq flag T)
  (while flag
    (setq temp(entsel "\nВыбери ИИ блок со скважиной: "))
    (if (eq(type temp)'list)
      (setq obj (car temp))
      (setq obj temp))
    (if (and (eq (cdr(assoc 0 (entget obj))) "INSERT")(eq (cdr(assoc 2 (entget obj))) "ИИ25001"))
      (progn
	
	(setq 3Dsurface (vlax-ename->vla-object 3Dsurface))
	(setq insert-point (cdr(assoc 10 (entget obj))))
	(setq list-all-atts (get-all-atts obj))
	(setq z (append (list(get-elevation-by-XY-in-surfese_ 3Dsurface insert-point)) list-all-atts))
	(setq flag nil)
	)
      (alert "Ошибка! Выбраный объект не блок ИИ. Попробуй снова.")
      )
    )
  z
  )