BrianTFC Posted July 17, 2015 Posted July 17, 2015 Here are a few Print Lisp that I've come up with help of a multitude of people on this website, I thought that I would share them for whoever would like to use them. Enjoy!!! ;;; Shop Prints 18x24 (defun c:Shop (/ ob ss bn mn mx) (vl-load-com) (pltnum) (if (and (progn (initget "B") (setq ob (entsel "\nSelect Block/B for blockname: ")) (cond ((eq ob "B") (setq bn (getstring "\nEtner Block Name: ")) ) ((and (eq (type ob) 'LIST) (vlax-method-applicable-p (vlax-ename->vla-object (car ob)) 'getboundingbox)) (setq bn (cdr (assoc 2 (entget (car ob)))))))) (tblsearch "BLOCK" bn) bn (setq ss (ssget "_X" (list '(0 . "INSERT")'(410 . "Model")(cons 2 bn)))) ) (progn (vla-zoomextents (vlax-get-acad-object)) (repeat (setq i (sslength ss)) (vla-getboundingbox (vlax-ename->vla-object (ssname ss (setq i (1- i)))) 'mn'mx) (repeat xplta (command "plot" "yes" "model" "Your Plotter Name.pc3" "18x24(ARCH C)" "inches" "LANDSCAPE" "no" "Window" (trans (vlax-safearray->list mn) 0 1) (trans (vlax-safearray->list mx) 0 1) "fit" "center" "yes" "Your.ctb" "yes" "no" "no" "yes" "yes") ) ) (princ "\nNo Blocks Selected: ") ) ) (defun pltnum () (setq numplt (getint "\nEnter Number of Plots <1>: ")) (if (= numplt nil) (setq xplt 1) (setq xplt numplt)) (if (<= xplt 15) (setq xplta xplt) (setq xplta 15)) ) (princ) ) ;;; LAYOUT PRINT 18x24 (defun c:Tab ( / CURRENTTAB) (pltnum) (setq CURRENTTAB (getvar "ctab")) (repeat xplta (foreach LAYOUT (layoutlist) (setvar "ctab" LAYOUT) (command "-plot" "yes" "" "Your Plotter Name.pc3" "18x24(ARCH C)" "Inches" "LANDSCAPE" "NO" ;PLOT UPSIDE DOWN "EXTENTS" "FIT" "center" "YES" ;PLOT WITH PLOTSYTLES "Your.CTB" "NO" ;PLOT WITH LINEWEIGHTS "NO" ;SCALE LINEWEIGHTS WITH PLOT SCALE "YES" ;PLOT PAPER SPACE LAST "NO" ;REMOVE HIDDEN LINES "NO" ;WRITE THE PLOT TO A FILE "NO" ;SAVE CHANGES TO LAYOUT "YES");PROCEED WITH PLOT ) ) (defun pltnum () (setq numplt (getint "\nEnter Number of Plots <1>: ")) (if (= numplt nil) (setq xplt 1) (setq xplt numplt)) (if (<= xplt 15) (setq xplta xplt) (setq xplta 15)) ) (setvar "ctab" CURRENTTAB) (princ) ) ;;; Printpage18 (defun c:prp18 (/ ss mn mx) (vl-load-com) (pltnum) (if (setq ss (ssget "_:S:E" '((0 . "INSERT,LWPOLYLINE")))) (progn (vla-getboundingbox (vlax-ename->vla-object (ssname ss 0)) 'mn'mx) (repeat xplta (command "plot" "yes" "model" "Your Plotter Name.pc3" "18x24(ARCH C)" "inches" "LANDSCAPE" "no" "Window" (trans (vlax-safearray->list mn) 0 1) (trans (vlax-safearray->list mx) 0 1) "fit" "center" "yes" "Your.ctb" "yes" "no" "no" "yes" "yes") ) ) ) ) (defun pltnum () (setq numplt (getint "\nEnter Number of Plots <1>: ")) (if (= numplt nil) (setq xplt 1) (setq xplt numplt)) (if (<= xplt 15) (setq xplta xplt) (setq xplta 15)) ) ;;; PDF's All Tabs to source drawing folder with Tab name. (defun c:pdf ( / *error* cm fd ) (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) ) (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: "ARCH expand C (18.00 x 24.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]: "tfc.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 ;; Enter file name: (getvar 'dwgprefix) (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) ) Quote
BlackBox Posted July 17, 2015 Posted July 17, 2015 FWIW - These may save you a great deal of time: Autopublish Mechanism - this is used to produce a PDF or DWF at drawing SAVE, or CLOSE (user configurable), and is exponentially faster than PLOT, or PUBLISH. vla-SetActivePageSetup LispFunction - is used to apply a named Page Setup to one or more Layouts, and can be used via ObjectDBX to batch process. Example: (foreach layoutname (layoutlist) (vla-SetActivePageSetup layoutname [color="red"]“YourPageSetupName”[/color]) ) Quote
BIGAL Posted July 18, 2015 Posted July 18, 2015 BrianTFC a few more. Once you get one to work its easy to add more. Plot range of layouts start-end PDF, colour & mono plot all by title blocks in model or layout. http://www.cadtutor.net/forum/showthread.php?69132-Printing-LISP-Help...&highlight=Printing-LISP http://www.cadtutor.net/forum/showthread.php?67143-One-Click-Printing http://www.cadtutor.net/forum/showthread.php?67793-script-to-plot-all-(named)views/page2&highlight=views http://www.cadtutor.net/forum/showthread.php?84430-Move-layout-Rename-layouts-Goto-layout 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.