(defun C:test () ;(/ ang cumm_dist dis dist_list leng obj pt)
(vl-load-com)
;; build master list of the distances, starting from 0.0 - important!
(setq fn (getfiled "Enter file name without extension"(getvar "dwgprefix")"txt" 4))
(setq fp (open fn "r")
lst '()
)
;; Iterate the file, writing each line to
;; the list
(while (setq l (read-line fp))
(setq lst (cons l lst))
)
;; Close the file.
(close fp)
;; Reverse the list
; (setq lst (reverse lst))
;string to list of real numbers
(foreach x lst
(setq lst1 (cons (read x) lst1))
)
(reverse lst1)
(setq dist_list 'lst1)
;(print dist_list)
(setq cumm_dist (apply '+ A))
(setq dis 0.0)
(setq obj (vlax-ename->vla-object
(car (entsel "\n >> Select profile >>"))
)
)
(setq leng (vlax-curve-getdistatpoint obj (vlax-curve-getendpoint obj)))
(setq A (ENTSEL "\PICK THE BLOCK YOU WANT TO ARRAY "))
(setq B (entget (car a)))
(setq BLK (cdr (assoc 2 b)));EXTRACT THE BLOCK NAME
;; check if pline length is not less than the cumulative distance
(if (< leng cumm_dist)
(progn
(alert "Pline length is less then summary distance")
(princ)
)
(while (< dis cumm_dist)
(setq dis (+ dis (car lst1)))
(setq pt (vlax-curve-getpointatdist obj dis))
;; get angle:
(setq ang (angle '(0 0 0)
(vlax-curve-getfirstderiv
obj
(vlax-curve-getparamatpoint obj pt)
)
)
)
;;insert block:
(vlax-invoke
(vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))
'InsertBlock pt BLK 1 1 1 ang)
(setq dist_list (cdr dist_list))
)
)
(princ)
)