is there a way to code inserting all pdfs in a multi-page pdf at once?
another one would be, say, you have several pdfs in your dwg that represent different aspects of the same space so you select them (they are on top of each other) and it puts them into a dynamic block automatically in different visualization states (maybe labeled 01,02,03 etc.) and you make one of the sheets visible with a drop down button.
i might be able to figure out the later if there is a way to do the former.
any tips or suggestions on a way to do it would be appreciated.
thanks, alex
Yes, you can do it.
Here is a rough demo which creates a single row (assumes 8-1/2" wide pdfs).
;;Insert all pdf pages of a file ;;assumes single row at 8-1/2" spacing ;;Demo only ;;D.C. Broad, Jr. 2012 ;;Warning: Once started, cannot be escaped from till done. (defun c:atall (/ fn n pt) (setq fn (getfiled "Select PDF File" "" "pdf" 8)) (setq n 1) (setq pt '(0.0 0.0 0.0));;prompt for insertion point here (while (not (vl-catch-all-error-p ;avoid error trigger (vl-catch-all-apply '(lambda () (command "-pdfattach" fn (itoa n) pt 1 0) ) nil ) ) ) (setq n (1+ n)) (setq pt (polar pt 0.0 8.5)) ) (command);cancel out of index pdf underlay (princ);quietly exit )
Here is a demo that can be used to change a page number of a pdf already inserted. I would not advise putting PDF's into dynamic blocks.
;;To set a page number of the pdf file. ;;If the file disappears(page doesn't exist, use undo to get it back. ;;D. C. Broad, Jr. 2012 (defun c:setpg() (prompt "\nSelect PDF") (setq ss (ssget ":S:E" '((0 . "PDFUNDERLAY")))) (setq ob (vlax-ename->vla-object(ssname ss 0))) (initget 7) (vla-put-itemname ob (itoa (getint "\nNew Sheet number: "))) (vla-update ob) )
I was working on a similar function and found your post trying to debug. It seems that AutoCAD doesn't consider running out of pdf pages as an error, so your code stays in an endless loop once it has inserted all the pages and never exits. It continues running and considers the next value as an invalid insertion point (also apparently not considered an error by vl-catch-all-error).
Any ideas how to clue AutoCAD in to recognizing that there are no more pages in the pdf document?
yes
AutoCAD all ver.
model to pdf
ref. pline or block
Paper Size Select
Plot Style Select
Pdf No Select
and run goto pdf
yes
this is possible
there is