(defun analisis-surfese-and-2d-poly (surfese obj-pline /
				     full-points-list ins-point line-list n nn nnn points-list resul-line-list resul-points-list temp triangles-list
				     )
  ; Возвращает список трехмерных точек проекции полилинии на поверхность
  (load_global_variable)
  (if (eq (type surfese) 'ename)
    (setq surfese (vlax-ename->vla-object surfese)))
  (if (eq (type obj-pline) 'ename)
    (setq obj-pline (vlax-ename->vla-object obj-pline)))
  
  (setq triangles-list(vlax-get surfese 'OutputTriangles))
  (setq n 0)
  (repeat (/(length triangles-list)3)
    (setq temp (append temp (list(list (nth n triangles-list)(nth (1+ n) triangles-list)(nth (+ n 2) triangles-list)))))
    (setq n (+ n 3))
    )
  (repeat (/(length temp)3)
    (setq line-list (append line-list (list(list (car temp)(cadr temp)))))
    (setq line-list (append line-list (list(list (cadr temp)(caddr temp)))))
    (setq line-list (append line-list (list(list (caddr temp)(car temp)))))
    (setq temp (cdddr temp))
    )
  (foreach x line-list
    (if (not (or(member x resul-line-list)(member (list (cadr x)(car x)) resul-line-list)))
      (setq resul-line-list (append resul-line-list (list x)))
      )
    )
  (setq points-list(convert-safearray-to-list-points(vlax-variant-value(vla-get-Coordinates obj-pline))2))
  (setq resul-points-list(list(list 0(get-elevation-by-XY-in-surfese surfese(nth 0 points-list)))))
  (setq nn 0)
  (repeat (1-(length points-list))
    (setq nnn 0)
    (repeat (length resul-line-list)
      (setq ins-point(inters (nth nn points-list)(nth (1+ nn) points-list)
			     (list(nth 0(car(nth nnn resul-line-list)))(nth 1(car(nth nnn resul-line-list)))0.0)
			     (list(nth 0(cadr(nth nnn resul-line-list)))(nth 1(cadr(nth nnn resul-line-list)))0.0)T))
      (if ins-point
	(setq resul-points-list (append resul-points-list(list(list(vlax-curve-getParamAtPoint obj-pline ins-point)
								   (get-elevation-by-XY-in-surfese surfese ins-point)
								   ))))
	)
      (setq nnn (1+ nnn))
      )
    (setq resul-points-list (append resul-points-list(list(list(vlax-curve-getParamAtPoint obj-pline (nth (1+ nn) points-list))
							       (get-elevation-by-XY-in-surfese surfese(nth (1+ nn) points-list))
							       ))))
    (setq nn (1+ nn))
    )
  (foreach x (vl-sort (mapcar 'car resul-points-list) '<)
    (setq full-points-list (append full-points-list(list (cadr(assoc x resul-points-list)))))
    )
  )

(defun get-elevation-by-XY-in-surfese (surfese point / z)
  (if(vl-catch-all-error-p
       (setq z (vl-catch-all-apply 'vlax-invoke-method (list surfese"FindElevationAtXY"(car point)(cadr point))))
       )
    (setq z 0.00)
    )
  (append point (list z))
  )