+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Senior Member
    Discipline
    Manufacture
    BrianTFC's Discipline Details
    Occupation
    Structral Detailer
    Discipline
    Manufacture
    Using
    AutoCAD 2017
    Join Date
    Jan 2012
    Location
    Indiana
    Posts
    158

    AutoCAD A couple of Print Lisp Routines that might come in handy!!!

    Registered forum members do not see this ad.

    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!!!

    Code:
    ;;; 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)
          )
    Code:
    ;;; 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)
    )
    Code:
    ;;; 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))
    )
    Code:
    ;;; 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)
    )

  2. #2
    Luminous Being BlackBox's Avatar
    Computer Details
    BlackBox's Computer Details
    Operating System:
    Windows 8.1 Professional, Server 2012 R2 Datacenter
    Computer:
    Dell Precision T3600
    CPU:
    Hex-Core Intel Xeon 3.2Ghz
    RAM:
    32GB
    Graphics:
    3GB NVIDIA Quadro K4000
    Primary Storage:
    2 x 240GB Samsung EVO SSD (RAID 0)
    Secondary Storage:
    1TB Western Digital VelociRaptor 10K RPM
    Monitor:
    Dual 24" Dell Ultrasharp Widescreen Monitors
    Discipline
    Civil
    BlackBox's Discipline Details
    Occupation
    Senior Civil Designer
    Discipline
    Civil
    Details
    Public/Private Land Development, Transportation, and Utilities.
    Using
    Civil 3D 2016
    Join Date
    Nov 2009
    Posts
    5,282

    Default

    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:

    Code:
    (foreach layoutname (layoutlist)
      (vla-SetActivePageSetup layoutname “YourPageSetupName”)
    )
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD, and Civil 3D Certified Professional | Autodesk Authorized Developer
    Sincpac C3D ~ Exchange Apps ~ Autoloader ~ AutoCAD Security

  3. #3
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,748

    Default

    Registered forum members do not see this ad.

    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/showth...=Printing-LISP
    http://www.cadtutor.net/forum/showth...Click-Printing
    http://www.cadtutor.net/forum/showth...ighlight=views
    http://www.cadtutor.net/forum/showth...ts-Goto-layout
    A man who never made mistakes never made anything

Similar Threads

  1. A couple of simple lisp routines
    By Jman in forum AutoLISP, Visual LISP & DCL
    Replies: 8
    Last Post: 15th Jun 2015, 02:57 pm
  2. How many of you still use LISP routines?
    By Currahee in forum AutoCAD General
    Replies: 13
    Last Post: 19th Feb 2013, 05:11 am
  3. LISP Routines: How To.
    By resullins in forum AutoLISP, Visual LISP & DCL
    Replies: 27
    Last Post: 1st Apr 2011, 04:26 pm
  4. Replies: 3
    Last Post: 10th Aug 2010, 04:39 am
  5. Lisp library - very handy
    By clionutta in forum Useful Links
    Replies: 6
    Last Post: 30th Nov 2009, 02:24 pm

Tags for this Thread

Bookmarks

Posting Permissions

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