Message 1 of 3
Plot Lisp for printing on variable paper length
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I’m trying to modify my LISP that I wrote for printing drawings to PDF. The LISP works well, but there might be some errors. I tried to rewrite it for English commands. My tested LISP is in Czech. This LISP works for A3 paper size. It should read the drawing limits and save it to the _U subfolder.
However, I would like to know if the LISP can be modified for longer paper lengths. We have drawings of various lengths. The height is always 297mm, but the length varies. I don’t want to create a new paper size for each print. Is there a way to automate this?
(defun C:PDFA3S (/ oldCmdDia filename filepath limMin limMax) (setq oldCmdDia (getvar "CMDDIA")) ;; Enables dialog boxes for commands (setvar "CMDDIA" 1) (setq filename (getvar "DWGNAME")) (setq filename (vl-filename-base filename)) ;; Removes the .dwg extension ;; Gets the path to the DWG file and adds the "_U" subfolder (setq filepath (strcat (getvar "DWGPREFIX") "_U\\")) ;; Creates the "_U" subfolder if it doesn't exist (if (not (vl-file-directory-p filepath)) (vl-mkdir filepath) ) ;; Retrieves the current drawing limits (setq limMin (getvar "LIMMIN")) (setq limMax (getvar "LIMMAX")) ;; Displays the current drawing limits (princ (strcat "\nCurrent drawing limits: " (rtos (car limMin) 2 2) ", " (rtos (cadr limMin) 2 2) " to " (rtos (car limMax) 2 2) ", " (rtos (cadr limMax) 2 2))) (command "PLOT" "Y" ;; enables detailed plot configuration "Model" ;; layout name "DWG TO PDF.pc3" ;; output device name - printer/plotter "ISO A3 full (297.00 x 420.00 mm)" ;; paper size "M" ;; paper size in millimeters "L" ;; landscape orientation "N" ;; do not plot upside down "E" ;; extents "F" ;; fit to paper "0.00,0.00" ;; offset "Y" ;; use plot style "monochrome.ctb" ;; monochrome "Y" ;; plot object lineweights "V" ;; plot with plot styles (strcat filepath filename ".pdf") ;; Automatically save to "_U" subfolder "N" ;; do not save changes to page setup "Y" ;; plot ) ;; Restores the original CMDDIA value (setvar "CMDDIA" oldCmdDia) (princ) )