GregGleason Posted April 11, 2018 Posted April 11, 2018 I have a nice utility to plot to .pdf (courtesy of BrianTFC) which works fine in the model plots. (defun c:Test() (vl-load-com) (if (setq filename (getfiled "Save File Location" "" "pdf" 1)) (progn (command "-plot" "yes" "" "DWG To PDF.pc3" "ANSI expand B (11.00 x 17.00 Inches)" "inches" "landscape" "yes" "Extents" "fit" "center" "yes" "monochrome.ctb" "yes" "a" filename "no" "yes") ) ) ) However, in Layout it does not work, and gives a few clues on what is going on. Unknown command "MODELS\LYONDELL\2018-071\MODELS\PIPING\PIPE TEST 2.PDF". Press F1 for help. Unknown command "NO". Press F1 for help. Unknown command "YES". Press F1 for help. One, what does the code need to work. Two, so how can you know what the order is? Can you prompt the system to give you hints? Here is the plot dialog for model: Here is the plot dialog for layout: Greg Quote
BIGAL Posted April 12, 2018 Posted April 12, 2018 Here is a plotpdf range of layouts it plots to a pdf directory under the dwg directory. It may give some clues, I am not sure why you are looking in findfile for pdf that implies that one already exists. plotA3Pdfrange2.lsp GETVALS3.lsp Quote
GregGleason Posted April 12, 2018 Author Posted April 12, 2018 Here is a plotpdf range of layouts it plots to a pdf directory under the dwg directory. It may give some clues, I am not sure why you are looking in findfile for pdf that implies that one already exists. Thank you. Starting to learn a bit. Greg Quote
BrianTFC Posted April 12, 2018 Posted April 12, 2018 GregGleason Give this a try. ;;; PDF's All Tabs to a folder of your chose. (defun c:pdflay ( / *error* cm fd ) (chcolor) (defun *error* ( msg ) (if (= 'int (type cm)) (setvar 'cmdecho cm) ) (if (= 'int (type fd)) (setvar 'filedia fd) ) (if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")) (princ (strcat "\nError: " msg)) ) (princ) ) (if (not (setq folder (getfolder "Select folder to save PDF'S"))) (setq folder (getvar 'dwgprefix))(setq folder (strcat folder "\\"))) (foreach layoutname (vl-remove "Model" (layoutlist)) (command "._layout" "set" layoutname) (progn (setq fd (getvar 'filedia) cm (getvar 'cmdecho) ) (setvar 'filedia 0) (setvar 'cmdecho 0) (command "-plot" "_Y" ;; Detailed plot configuration? [Yes/No]: "" ;; Enter a layout name <Current-Layout>: "dwg to PDF" ;; Enter an output device name: "ANSI expand B (11.00 x 17.00 Inches)" ;; Enter paper size: "_I" ;; Enter paper units [inches/Millimeters]: "_L" ;; Enter drawing orientation [Portrait/Landscape]: "_N" ;; Plot upside down? [Yes/No]: "_E" ;; Enter plot area [Display/Extents/Layout/View/Window]: "_F" ;; Enter plot scale (Plotted Inches=Drawing Units) or [Fit] <1=1>: "_C" ;; Enter plot offset (x,y) or [Center]: "_Y" ;; Plot with plot styles? [Yes/No]: ctb ;; Enter plot style table name (enter . for none): "_Y" ;; Plot with lineweights? [Yes/No]: "_N" ;; Scale lineweights with plot scale? [Yes/No]: "_N" ;; Plot paper space first? [Yes/No]: "_N" ;; Hide paperspace objects? [Yes/No]: (strcat folder (cadr (fnsplitl (getvar 'dwgname))) "-" (getvar 'ctab) ".pdf") "_N" ;; Save changes to page setup [Yes/No]: "_Y" ;; Proceed with plot [Yes/No]: ) (setvar 'cmdecho cm) (setvar 'filedia fd) ) (princ "\nCommand not available in Modelspace.") ) (princ) ) (defun chcolor () (initget "Black Color") (setq pp (getkword "\nChoose Color [black/Color] <Black>: ")) (if (= pp "Black") (setq ctb "monochrome.ctb")) (if (= pp "Color") (setq ctb "acad.ctb")) (if (= pp nil) (setq ctb "monochrome.ctb")) )(princ) (defun getfolder (msg / fl sh) (if (and (setq sh (vlax-create-object "Shell.Application"))(setq fl (vlax-invoke sh 'browseforfolder 0 msg 0 ""))) (setq fl (vlax-get-property (vlax-get-property fl 'self) 'path))(setq fl nil))(release_me (list sh)) fl) (defun release_me (lst) (mapcar '(lambda (x)(if (and (= 'vla-object (type x))(not (vlax-object-released-p x)))(vlax-release-object x))(set (quote x) nil)) lst)) (princ) Brian Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.