(defun c:pdf (/ lst a b fin)
;; Igal Averbuh, 04.02.15 https://lispbox.wordpress.com
;; DosLib required

(if (setq lst (dos_getfilem "Select PDF's to insert:" (getvar "dwgprefix") "" ))
((lambda (layers)
(foreach file (vl-sort (cdr lst) (function >))
(setq ipoint (getpoint "select insertion point"))
(setq pagenum 1)
(setq pagetotal (getreal "\nType Total Number of Pages you want to Insert: "))
(if fin
(progn
(vla-GetBoundingBox (car fin) 'a 'b)
(setq b (vlax-safearray->list b))
(vl-cmdf "_pdfattach" (strcat (car lst) file) (list 0. (1+ (cadr b))) "")
)

(while (vla-object (entlast)) fin)))
(vla-get-name (vla-add layers (vl-filename-base file)))
)
)
)
(vla-get-layers
(cond (*AcadDoc*)
((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
)
)
)
)
(princ)
)
(c:pdf)

Advertisements