(defun C:add_PICKET_by_polyline_and_surfese ( / 2dpline 3d-point-list surfese 3d-point-list)
  (if(setq 2Dpline (car (entsel "\nВыберите 2D полилинию: ")))
    (if (eq (cdr(assoc 0 (entget 2Dpline))) "LWPOLYLINE")
      (if (setq surfese (car (entsel "\nВыберите поверхность: ")))
	(if (eq (cdr(assoc 0 (entget surfese))) "AECC_TIN_SURFACE")
	  (progn
	    (setq 3d-point-list
		   (vl-remove-if
		     (function (lambda (x) (if (eq (caddr x)0)T nil)))
		     (analisis-surfese-and-2d-poly surfese 2Dpline)
		     )
		  )
	    (foreach x 3d-point-list
	      (edit-block-set-attributes-by-list
		(draw-insertblock-vla-by-list-property
		  (list(cons "spece" model_spece)
		       (cons "InsertionPoint" x)
		       (cons "EffectiveName" "PICKET")
		       (cons "XScaleFactor" (/ 1.0 (getvar "CANNOSCALEVALUE")))
		       (cons "YScaleFactor" (/ 1.0 (getvar "CANNOSCALEVALUE")))
		       (cons "ZScaleFactor" (/ 1.0 (getvar "CANNOSCALEVALUE")))
		       (cons "Rotation" 0.0)
		       
		       ))
		(list (cons "OTMETKA" (rtos (nth 2 x) 2 2)))
		)
	      )

	    )
	  (alert "Выбран не допустимый объект!")
	  )
	(alert "Ничего не выбрано!")
	)
      (alert "Выбран не допустимый объект!")
      )
    (alert "Ничего не выбрано!")
    )
  
  
  
  (princ)
  )