Placing multi-sheet PDFs into AutoCAD, semi-automatically

With regard to last week's post on modifying the PDF sheet display, I've taken another approach and come up with the following lisp code that will allow you to import some or all of the sheets of a multi-sheet PDF all at once. I realize that the built-in PDFATTACH command allows you to place multiple sheets at once, but you can't see the sheets as you place them. This lisp code is also more of a "how-to" for use in larger routines perhaps - and because such, this is raw lisp code with no error checking. Feel free to dress it up and append the header.

Load the lisp file and then type in the command PMP. Select a multi-sheet PDF file, and then enter the number of sheets you want to insert (this should be equal or less than the total number of sheets in the PDF). At this point you can start picking the lower left corner for each sheet until you reach the end.

I suspect there are some PDF libraries available by which you could expand this further, by detecting the number of sheets and maybe even the page size - which would allow for a fully automated tool to place multiple sheets.


;|

R.K. McSwain, Copyright © 2012 - cadpanacea.com

|;

(defun C:PMP ( / fname cnt i)  
  (setq fname (getfiled "\nSelect Multisheet PDF File" (getvar "dwgprefix") "PDF" 0))
  (setq cnt (getint "\nNumber of sheets in this PDF to place ") i 1)
  (if fname
    (repeat cnt
      (vl-cmdf "-pdfattach" fname i (getpoint "\nPick LL point for next sheet ") 1.0 0.0)
      (setq i (1+ i))
    ) 
  )
  (princ)
)

 


All content is copyright © CAD PANACEA 2005-2013 unless otherwise noted and may not be reproduced. All comments posted to this blog are the sole responsibility of the person making the comment.

Google, as a third party vendor, uses cookies to serve ads on this site. Google's use of their cookies enables it to serve ads to users based on their visit to your sites and other sites on the Internet. You may opt out of the use of these cookies by visiting the Google ad and content network privacy policy.

Powered by Drupal