Search the Community
Showing results for tags 'active layout'.
-
Hi all! I'm new to LISP--just started teaching myself yesterday--so I might have missed something obvious, but... I'm trying to write a routine that prints a PDF of a drawing to the same directory as the drawing itself, and that only prints the current layout sheet. The first half of that I have, thanks to the code examples posted by BIGAL and woodman78 here: http://www.cadtutor.net/forum/showthread.php?69132-Printing-LISP-Help... The second half--getting it to only print the current layout--is where I'm having trouble. Plotting every layout from the drawing is useful in some cases, but generally I just want the one I have selected at the time. This is what I'm using: (defun c:pdf () (setvar "cmddia" 0) (setvar "filedia" 0) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (vlax-for lay (vla-get-Layouts doc) (setq plottabs (cons (vla-get-name lay) plottabs)) ) (setq dwgname (getvar "dwgname")) (setq len (strlen dwgname)) (setq dwgname (substr dwgname 1 (- len 4))) (setq plottablist (acad_strlsort plotabs)) (setq len (length plottablist)) (setq x 0) (repeat len (setq name (nth x plottablist)) (princ name) (setq pdfname (strcat (getvar "dwgprefix") dwgname "-" name)) (if (/= name "Model") (progn (setvar "ctab" name) (command "-plot" "yes" "" "dwg to PDF" "ANSI full bleed B (11.00 x 17.00 Inches)" "inches" "landscape" "no" "extents" "fit" "center" "yes" "monochrome.ctb" "yes" "no" "no" "no" pdfName "n" "y" ) ) ) (setq x (+ x 1)) ) (setvar "cmddia" 1) (setvar "filedia" 1) (setq DWGNAME nil LEN nil NAME nil PLOTTABLIST nil) (princ) ) I've narrowed the issue down to the section here: (vlax-for lay (vla-get-Layouts doc) (setq plottabs (cons (vla-get-name lay) plottabs)) ) What would I use instead of vlax-for to get the name of just the current layout? Thanks