Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Print as PDF: Default for output-folder and so on

For "Print as PDF" - is there a default setting for output-folder, PDF-file format and all that stuff?

Or just the standard "save file as .." dialogue?

Comments

  • Peter2,
    Lisp routine @ bottom of post is how I create PDFs; note it defaults to C:\Users\mdunn\Documents, & I do not know how to change that default either. See attached "PDF print location.PNG"

    It would be nice to have the PDF created in the ext’g CADfile folder the PDF was created from; like AutoCAD does it. I would like to know how to make that happen too.

    BUG! WARNING! For anyone that reads this, the "Italic" does NOT work. When I tried to Italicize the text below by clicking the Italic button, it put an "Underscore" in front of the highlighted text. BUG!
    Mike

    ;DWG to PDF BricsCAD 5:02 PM 8/23/2018
    ;Saves to C:\Users\mdunn\Documents (not sure how to change this)
    ;B Size, PS, Extents, Color, PDF
    (defun c:PDF-Brics () ;starts lisp routine
    (Command "-Plot" ;Command Line Plot Command
    "YES" ;Detailed plot configuration?
    "" ;Enter a layout name, Keeps ext'g name (Layout1)
    "Brics PDF 8-23-2018.pc3" ;Enter an output device name
    "Ledger" ;Enter paper size
    "Inches" ;Enter paper units
    "Landscape" ;Enter drawing orientation
    "NO" ;Plot upside down?
    "Extents" ;Enter plot area
    "FIT" ;Enter plot scale
    "Center" ;Enter plot offset
    "YES" ;Plot with plot styles?
    "acad.ctb" ;Enter plot style table name
    "YES" ;Plot with lineweights?
    "NO" ;Scale lineweights with plot scale?
    "YES" ;Plot paper space last?
    "NO" ;Remove hidden lines in paper space?
    "No" ;Write the plot to a file?
    "NO" ;Save changes to page setup
    "Yes") ;Proceed with plot
    (princ "\n\t PDF to C:/Users/mdunn/Documents ") ;Comment @ routine completion
    (princ) ;No Nil returned
    ) ;Ends PDF-Brics lisp routine

    PDF print location.PNG
    507 x 274 - 38K
  • @Peter2 said:
    For "Print as PDF" - is there a default setting for output-folder, PDF-file format and all that stuff?

    Or just the standard "save file as .." dialogue?

    in SETTINGS change PlotOutputPath to your preferred folder. By default it gets set to your documents folder.

    Regards,
    Jason Bourhill
    CAD Concepts

  • @MDunn said:

    BUG! WARNING! For anyone that reads this, the "Italic" does NOT work. When I tried to Italicize the text below by clicking the Italic button, it put an "Underscore" in front of the highlighted text. BUG!
    Mike

    It does work, the "Underscore" is markdown notation. You can also use a single "Asterisk" either side. Position of the underscore is important, which might be why it didn't work e.g.

    _
    Using an Enter after the Underscore won't give italic text
    _

    In you case I think you would want to use code highlighting (available under the ¶ menu item) to give this

    ;DWG to PDF BricsCAD 5:02 PM 8/23/2018
    ;Saves to C:\Users\mdunn\Documents (not sure how to change this)
    ;B Size, PS, Extents, Color, PDF
    (defun c:PDF-Brics () ;starts lisp routine
    (Command "-Plot" ;Command Line Plot Command
    "YES" ;Detailed plot configuration?
    "" ;Enter a layout name, Keeps ext'g name (Layout1)
    "Brics PDF 8-23-2018.pc3" ;Enter an output device name
    "Ledger" ;Enter paper size
    "Inches" ;Enter paper units
    "Landscape" ;Enter drawing orientation
    "NO" ;Plot upside down?
    "Extents" ;Enter plot area
    "FIT" ;Enter plot scale
    "Center" ;Enter plot offset
    "YES" ;Plot with plot styles?
    "acad.ctb" ;Enter plot style table name
    "YES" ;Plot with lineweights?
    "NO" ;Scale lineweights with plot scale?
    "YES" ;Plot paper space last?
    "NO" ;Remove hidden lines in paper space?
    "No" ;Write the plot to a file?
    "NO" ;Save changes to page setup
    "Yes") ;Proceed with plot
    (princ "\n\t PDF to C:/Users/mdunn/Documents ") ;Comment @ routine completion
    (princ) ;No Nil returned
    ) ;Ends PDF-Brics lisp routine
    

    In the case of other PDF printers such as Adobe, the output folder is something you would need to set in the printer driver settings.

    Regards,
    Jason Bourhill
    CAD Concepts

  • Jason,
    How does one set it to print to the folder of the currently opened dwg? I don't see an option for that.
    Mike

  • @MDunn said:
    Jason,
    How does one set it to print to the folder of the currently opened dwg? I don't see an option for that.
    Mike

    It would be nice if you could use environment variables and system variables in the folder options such as
    %DWGPREFIX%\\PDF

    You could achieve by using some LISP e.g.
    (setvar 'PlotOutputPath (strcat (getvar 'DWGPREFIX) "PDF"))
    If you do this, then you would also need to check that the folder actually exists first.

    If you use PUBLISH to PDF, then there is an option there to print out to a sub folder.

    Regards,
    Jason Bourhill
    CAD Concepts

  • Jason,
    Thank you, I have learned LISP on the fly, only dangerous @ it; not expert level, but would like to learn more.
    Will give your example a try. It has been a wonderment why in AutoCAD when printing a PDF it always created the PDF in the same folder the DWG lives, by not so w/ BricsCAD. Hopefully this will solve that irritant.
    Thanks again,
    Mike

  • @MDunn said:
    Jason,
    Thank you, I have learned LISP on the fly, only dangerous @ it; not expert level, but would like to learn more.
    Will give your example a try. It has been a wonderment why in AutoCAD when printing a PDF it always created the PDF in the same folder the DWG lives, by not so w/ BricsCAD. Hopefully this will solve that irritant.
    Thanks again,
    Mike

    On checking, my option won't actually work consistently. BricsCAD only refers to PlotOutputPath for the first print of the drawing session. After that it defaults to the folder that you last printed to. So you would need to restart BricsCAD every time you changed PlotOutputPath, which isn't ideal. I tried turning REMEMBERFOLDERS off, but this had no effect. The alternative would be to write a LISP similar to your PDF-Brics.

    ; Print Relative
    ; Sets BricsCAD's Print Output Folder to be relative to the current drawing folder
    
    (defun C:PrintRelative ( / SubFolder PrintFolder PrintName flag FullPrintName )
        (setq SubFolder "PDF") ; define the subfolder. Set to "" if you prefer to use the current .dwg folder
        (setq PrintFolder (strcat (getvar 'DWGPREFIX) subfolder)) ; define the print folder we want to use
        (setq PrintName (strcat (vl-filename-base (getvar 'DWGNAME)) "-" (getvar 'CTAB))) ; Set the name for the print
    
        ; Check our chosen folder exists
        (cond 
            ((not (vl-file-directory-p printfolder)) ; If the folder doesn't exist
                (setq flag (vl-mkdir printfolder)) ; Create it. If successful the flag will be set to T
            )
            (T (setq flag T)) ; Folder already exists
        )
    
        ; Tell the user where we are printing
        (cond
            (flag (princ (strcat "\nPrinting to: " printfolder))) ; Use chosen folder
            (T (princ (strcat "\nCouldn't set Print folder to: " PrintFolder " Printing to: " (setq PrintFolder (getvar 'PlotOutputPath)) ))) ; alternate folder
        )
        (setq FullPrintName (strcat PrintFolder "\\" PrintName)) ; Set the folder and filename
    
        ; BricsCAD doesn't respect EXPERT for printing, so need to check whether the print already exists and adjust the PLOT command to suit
        ; Note this doesn't check if the file is currently open in your PDF viewer!
        (cond 
            ((member (strcase (strcat PrintName ".pdf")) (mapcar 'strcase (vl-directory-files PrintFolder "*.pdf")))
                (command "._PLOT" "_No" "" "" "Print As PDF.pc3" FullPrintName "_Yes" "_No" "_Yes")
            )
            (T  (command "._PLOT" "_No" "" "" "Print As PDF.pc3" FullPrintName "_No" "_Yes"))
        )
        (prin1)
    )
    

    Regards,
    Jason Bourhill
    CAD Concepts

    lsp
    lsp
    PrintRelative.lsp
    2K
  • Thanks @Jason Bourhill

    I will try it.

  • @Jason Bourhill
    2 small hints:

    1. You can use findfile to check if the PDF-file already exists.
    2. If the file exists I would try erasing it before calling the _Plot command. If this is unsuccessful then the file is locked (or the user does not have sufficient rights).
  • Jason,
    That works nicely.
    However, I notice the Title Block text & notes etc. in Paper Space were a lighter line-weight than the Model Space geometry.
    Tried it on another dwg, & the PDF was created upside down.
    Another one, right side up, but again less on the line-weights.
    What dictates the print parameters for creating the PDFs?
    Such as what CTB file does it use?
    Is there a way to specify the CTB file?

  • @Roy Klein Gebbinck said:
    @Jason Bourhill
    2 small hints:

    1. You can use findfile to check if the PDF-file already exists.
    2. If the file exists I would try erasing it before calling the _Plot command. If this is unsuccessful then the file is locked (or the user does not have sufficient rights).
    1. Doh. Obviously having a Senior moment. :-)
    2. Added check.

    Revised code:

    ; Print Relative
    ; Sets BricsCAD's Print Output Folder to be relative to the current drawing folder
    
    (defun C:PrintRelative ( / SubFolder PrintFolder PrintName flag FullPrintName filenm)
        (setq SubFolder "PDF") ; define the subfolder. Set to "" if you prefer to use the current .dwg folder
        (setq PrintFolder (strcat (getvar 'DWGPREFIX) subfolder)) ; define the print folder we want to use
        (setq PrintName (strcat (vl-filename-base (getvar 'DWGNAME)) "-" (getvar 'CTAB))) ; Set the name for the print
    
        ; Check our chosen folder exists
        (cond 
            ((not (vl-file-directory-p printfolder)) ; If the folder doesn't exist
                (setq flag (vl-mkdir printfolder)) ; Create it. Flag will be set to T if successful
            )
            (T (setq flag T)) ; Folder already exists
        )
    
        ; Tell the user where we are printing
        (cond
            (flag (princ (strcat "\nPrinting to: " printfolder))) ; Use chosen folder
            (T (princ (strcat "\nCouldn't set Print folder to: " PrintFolder " Printing to: " (setq PrintFolder (getvar 'PlotOutputPath)) ))) ; alternate folder
        )
        (setq FullPrintName (strcat PrintFolder "\\" PrintName)) ; Set the folder and filename
        (setq flag nil) ; re-initialse our flag
    
        ; BricsCAD doesn't respect EXPERT for printing, so need to check whether the print already exists and attempt to delete ourselves 
        (cond 
            ((setq filenm (findfile (strcat FullPrintName ".pdf"))) ; if the print file already exists
                (setq flag (vl-file-delete filenm)) ; then attempt to delete. Flag will be set to T if successful
            )
            (T (setq flag T)) ; File doesn't exist
        )
    
        ; Proceed with Printing provided its ok to do so.
        (cond
            (flag (command "._PLOT" "_No" "" "" "Print As PDF.pc3" FullPrintName "_No" "_Yes"))
            (T (princ (strcat "\nCouldn't print: \"" PrintName ".pdf\" Check if the file is currently OPEN"))) ; i.e. check if the file is currently open in your PDF viewer!
        )
        (prin1)
    )
    

    Regards,
    Jason Bourhill
    CAD Concepts

    lsp
    lsp
    PrintRelative.lsp
    2K
  • @MDunn said:
    Jason,
    That works nicely.
    However, I notice the Title Block text & notes etc. in Paper Space were a lighter line-weight than the Model Space geometry.
    Tried it on another dwg, & the PDF was created upside down.
    Another one, right side up, but again less on the line-weights.
    What dictates the print parameters for creating the PDFs?
    Such as what CTB file does it use?
    Is there a way to specify the CTB file?

    The LISP uses the current defaults applied to the layout when printing. You can look at PLOT to see details on what other options are available.

    It's best to create and apply a named PAGESETUP to your layouts. This will capture the CTB file, and other print parameters.

    The LISP explicitly uses the built-in "Print as PDF" pdf printer. When you change printers BricsCAD will attempt to detect the current paper size and set to the closest appropriate. This can lead to mismatches, which is what you are probably seeing. If you configure the layout first with "Print as PDF", then you shouldn't have issues with orientation.

    Note. This method of printing will only work with "Print as PDF" as it is the only one that provides you the option to specify the output location. If you run -PLOT you will see that you are given different options when using this printer. Using the print to file option with other pdf printers won't work. This just generates a .plt file that requires further processing to convert to .pdf.

    Regards,
    Jason Bourhill
    CAD Concepts

Sign In or Register to comment.
Origami
Origami is the Japanese word for paper folding. ORI means to fold and KAMI means paper and involves the creation of paper forms usually entirely by folding.

Powered by VanillaForums, Designed by Steam