Results 1 to 3 of 3

Thread: Printing

  1. #1
    Member
    Join Date
    2021-08
    Posts
    23
    Login to Give a bone
    0

    Default Printing

    I am trying to print to pdf, I would like to use the dwg name as the pdf name but I would like to specify a specific folder for storing it.

    The below code is what I have so far. however, I can't get it to save in this location "C:\Data\PDF"

    (defun c:PDF(/)

    (if (setq filename (getfiled "Enter Filename" "" "pdf" 1))
    (progn

    (command "tilemode" "0")
    (command "-plot" "No" "layout1" "*layout1*" "DWG TO PDF.pc3" C:\Data\PDF\filename "No" "Yes" ) ))
    (princ) )

    Thanks in advance,

  2. #2
    Member
    Join Date
    2022-10
    Posts
    12
    Login to Give a bone
    0

    Default Re: Printing

    Problems I can see:
    I'm not sure about the getfiled. I personally have predetermined paths (i.e. D:\Workfolder) for all the prints so I don't get input from user. I had one LISP back in the day that would ask for folder.
    Filename variable contains already everything, so you put that into the plot command. This is how to quickly fix your code:


    Code:
    (defun c:PDF(/)
    
    (if (setq filename (getfiled "Enter Filename" "" "pdf" 1))
    (progn
    
    (command "tilemode" "0")
    (command "-plot" "No" "layout1" "*layout1*" "DWG TO PDF.pc3" filename "No" "Yes" ) ))
    (princ) )
    Personally I would use detailed setup for printing and adjust further and look into how to get input from user and maybe find if there is better way to get the folder.

    BTW: try these commands, they can be quite helpful when dealing with printing or other functions (not to type in names again etc.)
    Code:
    (setq fpath (getvar "dwgprefix"))
    (setq fname (vl-filename-base (getvar "dwgname")))

  3. #3
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    561
    Login to Give a bone
    0

    Default Re: Printing

    Here is a plot to pdf. It plots multiple layouts to a PDF directory under the dwg location. It is set up for a fixed title block size and uses window to select so you may need to change the window values.

    Code:
    ;Plots layouts by range
    ; By Alan H Feb 2014
    (defun AH:pltlays ( / lay numlay numend)
    (SETVAR "PDMODE" 0)
    
    (setvar "fillmode" 1)
    (setvar "textfill" 1)
    
    (setq alllays (vla-get-Layouts (vla-get-activedocument (vlax-get-acad-object))))
    (setq count (vla-get-count alllays))
    (if (not AH:getvalsm)(load "Multi Getvals.lsp"))
    (setq vals (AH:getvalsm  (list "Enter plot range" "Enter start tab number" 6 4 "1" "Enter end tab number" 6 4 (RTOS COUNT 2 0))))
    
    (setq numlay (atoi (nth 0 vals)))
    (setq numend (atoi (nth 1 vals)))
    
    (setq len (+ (- numend numlay) 1))
    
    (setq dwgname (GETVAR "dwgname"))
    (setq lendwg (strlen dwgname))
    (setq dwgname (substr dwgname 1 (- lendwg 4)))
    
    (repeat len
    (vlax-for lay alllays
    (if (= numlay (vla-get-taborder lay))
      (setvar "ctab" (vla-get-name lay))
    ) ; if
    (setq pdfname (strcat (getvar "dwgprefix") "pdf\\" dwgname "-" (getvar "ctab")))
    
    ) ; for
    (setq lay nil)
    (setvar "textfill" 1)
    (setvar "fillmode" 1)
        (COMMAND "-PLOT"  "Y"  "" "DWG To PDF"
    	       "Iso full bleed A3 (420.00 x 297.00 MM)" "m" "LANDSCAPE"  "N"   "W"  "-6,-6" "807,560" "1=2"  "C"
    	       "y" "Acad.ctb" "Y"	"n" "n" "n" pdfName "N" "y"
        )
        
    (setq numlay (+ numlay 1))
    ) ; end repeat
    ) ; defun
    
    (AH:pltlays)
    Attached Files Attached Files

Similar Threads

  1. Replies: 1
    Last Post: 2017-03-06, 08:56 PM
  2. Simplified printing - printing interface upgrade
    By Wish List System in forum Revit Architecture - Wish List
    Replies: 1
    Last Post: 2016-10-26, 11:46 AM
  3. Replies: 1
    Last Post: 2013-03-25, 08:55 PM
  4. 2012: Xrefs not printing or printing in light gray
    By bap020799 in forum AutoCAD Plotting
    Replies: 4
    Last Post: 2011-08-10, 07:28 PM
  5. Printing Hp Laserjet 5000- Customer Logo not printing solid
    By thomas.huckabee in forum AutoCAD Plotting
    Replies: 10
    Last Post: 2005-05-26, 08:42 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •