Jump to content

Plotting - Model v. Layout - What Happened?


GregGleason

Recommended Posts

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:

 

 

attachment.php?attachmentid=63725&cid=1&stc=1

 

 

Here is the plot dialog for layout:

 

 

attachment.php?attachmentid=63726&cid=1&stc=1

 

 

Greg

Plt to PDF.jpg

Plt to PDF Layout.jpg

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...