Changing sheet to display in PDF Underlay

When you attach a multi-page PDF file as a reference in AutoCAD, you can choose which sheet to display (see below).

But what if you want to change that reference to a different sheet in the PDF file, later on? There is nothing in the Ribbon to do this, and "Page Number" is a read-only property in the Properties Palette. You could detach the reference and add it again with the new sheet number, but the following lisp function is quicker.

The lisp function below allows you to pick the PDF Underlay object on the screen, and then enter a new sheet number. The image on the screen is updated as soon as the command completes. Make sure you choose a valid sheet. If the PDF file contains 9 sheets and you enter 10, then the PDF reference will disappear.

The function is named "Foo" (feel free to rename) and it calls the PdfPage function.


R.K. McSwain, Copyright © 2011 -


(defun PdfPage (ent pag / sel dat)  
  (setq dat (entget (cdr (assoc 340 (entget ent)))))
  (entmod (subst (cons 2 pag) (assoc 2 dat) dat))
  (entupd ent)

(defun c:Foo ( / s n)
  (setq s (car (entsel)))
  (setq n (getstring "\nEnter new page: "))
  (pdfpage s n)

What else can you think of, to automate?


I love nothing more than a well researched tip. Well done you!


Thanks made my day a lot easier


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