(defun C:draw_3d_polyline_by_surfese ( / 3dpline list-point list_3d_point point z full-point)
  (setq 3Dpline (car (entsel "\nВыберите поверхность: ")))
  (if (eq (cdr(assoc 0 (entget 3Dpline))) "AECC_TIN_SURFACE")
    (progn
      (setq 3Dpline (vlax-ename->vla-object 3Dpline))
      (setq point(getpoint "\nУкажи начальную точку 3D полилинии: "))
      (while point
	(princ(setq full-point (get-elevation-by-XY-in-surfese_ 3Dpline point)))(terpri)
;;;	(princ (setq full-point (list (nth 0 point)(nth 1 point) z)))(terpri)(list (nth 0 point)(nth 1 point) (nth 3 point))
	(setq list-point (append list-point (list full-point)))
	(setq point(getpoint point "\nУкажи точку 3D полилинии<Enter-выход>: "))
	)
      (if list-point (draw_pline_entmake list-point nil T 0 0))
      )
    (alert "Ошибка! Выбрана не поверхность.")
    )
  (princ)
  )

(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)
    )
  (list (car point)(cadr point) z)
  )