AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

Quick Plot

Plotting in AutoCAD can be quite a time consuming and sometimes confusing exercise. In most drawing offices, there are normally not more than two plotters/printers, and if you look at things carefully, you will find that that the majority of the plots are produced using the same plot settings. As well, plotters only change at somewhat long intervals, therefore a wee bit of hard coding in regards to Plotter Configuration and Plot Styles is really neither here nor there.

That's where Quick Plot comes in. Quick Plot can be set up to use your more common plot configurations, plot styles and plot sheets, drastically cutting down on the time needed to plot.

Quick Plot is simple to use. Window the section of the drawing you want plotted - we use crop marks to ensure true scaling - select the plotter you want to plot too, select the size of sheet you would like to use, and away you go.

To customise this routine, all you have to do is create a Plot Configuration file (PC3) to suit your plotter, create a Plot Style file (CTB)  and then replace the names of these files with the names of the Plotters and Plot Styles within the coding.

First the DCL coding. Save this as "Q-Plot.dcl."

qplot : dialog {
    label = "Quick Plot 2002";

     : boxed_radio_column {
      label = "Choose Plotter :";

        //change the plotter name to suit your own
        : radio_button {
          label = "Plotter No &1";
          key = "rb1";
        }
        //change the plotter name to suit your own
        : radio_button {
          label = "Plotter No &2";
          key = "rb2"; 
        }

     }


     : boxed_radio_column {
      label = "Plot Size :";

        : radio_button {
          label = "A&0 - 1189 x 841";
          key = "rb5";
        }
        : radio_button {
          label = "A&1 -   841 x 594";
          key = "rb6"; 
        }
        : radio_button {
          label = "A&2 -   594 x 420";
          key = "rb7"; 
        }
        : radio_button {
          label = "A&3 -   420 x 297";
          key = "rb8"; 
        }
        : radio_button {
          label = "A&4 -   297 x 210";
          key = "rb9"; 
        }
     }
  
      ok_cancel ;  

               : paragraph {
		 : text_part {
                   label = "Designed and Created";
                 }
                 : text_part {
                   label = "by CAD Encoding";
                 }
               }
}

choose : dialog {
    label = "Quick Plot 2002";
     
       : text {
       label = "Continue with Plot?";
       alignment = centered;
       }

       ok_cancel ;  
                   
}
 

And Now the AutoLisp coding. Save this as "Q-Plot.lsp."


;;;CODING STARTS HERE

;|To customise this to suit your plotters, you need to do 3 things :

Create a PC3 plot configuration file and replace the value of the
variable "pltyp" with the name of your PC3 file.
eg. Replace  "RW-470 PLOTBASE.pc3" with "YOURPLOTTER.pc3"

Create a CTB plot style and replace the value of the variable "plstyle"
with the name of your CTB file.
eg. Replace "acad.ctb" with "your.ctb"

Replace all the "plsize" variables with your sheet sizes.

==============================================|;

(defun C:Q-PLOT ( / userclick userclick1 pltyp plstyle plsize
                              oldblip oldecho oldsnap dcl_id)

     ;preset the flags
     (setq userclick T)
     (setq userclick1 T)

     ;store system settings
     (setq oldblip (getvar "BLIPMODE")
              oldecho (getvar "CMDECHO")
              oldsnap (getvar "OSMODE"))

     ;set system variables
     (setvar "BLIPMODE" 0)
     (setvar "CMDECHO" 0)
     (setvar "OSMODE" 32)

     ;store the default plotter, plot style and plot size

     ;replace this with your pc3 file
     (setq pltyp "RW-470 PLOTBASE.pc3")
     ;replace this with your ctb file
     (setq plstyle "acad.ctb")
     ;replace this with your default sheet size
     (setq plsize "ISO A0 (1189.00 x 841.00 MM)")

     ;get the plotting area
     (setq pt1 (getpoint "\nSelect Lower Left Hand Corner
                 of Plotting Area: "))
     (setq pt2 (getcorner pt1 "\nSelect Upper Right Hand
                 Corner of Plotting Area: "))

     ;remember your manners
     (prompt "\nThanks.......")
     
     ;load the dialog
     (setq dcl_id (load_dialog "q-plot.dcl"))
     (if (not (new_dialog "qplot" dcl_id) ) (exit))
     (set_tile "rb1" "1")
     (set_tile "rb5" "1")

      ; set the tiles

      ;replace this with your first pc3 file
      (action_tile "rb1"
         "(setq pltyp \"RW-470.pc3\")")

     ;replace this with your second pc3 file
     (action_tile "rb2"
         "(setq pltyp \"DesignJet 700.pc3\")")

     ;replace all sheet sizes to match yours
     (action_tile "rb5"
         "(setq plsize \"ISO A0 (1189.00 x 841.00 MM)\")")
     (action_tile "rb6"
         "(setq plsize \"ISO A1 (841.00 x 594.00 MM)\")")
     (action_tile "rb7"
         "(setq plsize \"ISO A2 (594.00 x 420.00 MM)\")")
     (action_tile "rb8"
         "(setq plsize \"ISO A3 (420.00 x 297.00 MM)\")")
     (action_tile "rb9"
         "(setq plsize \"ISO A4 (297.00 x 210.00 MM)\")")
      (action_tile "cancel"
         "(done_dialog)(setq userclick nil)")
     (action_tile "accept"
         "(done_dialog) (setq userclick T)")

     ;start the dialog
     (start_dialog)

     ;unload the dialog
     (unload_dialog dcl_id)

  ;if OK is selected
  (if userclick

    ;do the following
    (progn

        ;preview the plot
        (command "Preview")

            ;load the "Continue" dialog
            (setq dcl_id (load_dialog "q-plot.dcl"))
            (if (not (new_dialog "choose" dcl_id) ) (exit))

            ;set up the tiles
            (action_tile "cancel"
            "(done_dialog)(setq userclick1 nil)")
            (action_tile "accept"
            "(done_dialog) (setq userclick1 T)")
            (start_dialog)
            (unload_dialog dcl_id)

       ;if it's OK to continue
       (if userclick1

        ;plot the drawing
        (command "-plot" "Yes" "Model" pltyp plsize "Millimeters"
                 "Landscape" "No" "Window" pt1 pt2 "Fit" "Center" 
                 "Yes" plstyle "Yes" "No" "No" "Yes" "Yes")

        ;the plot was Cancelled
        ;return to the main dialog
        (c:autoplot)

       );if userclick1
                  
       );progn

  );if userclick

     ;reset system variables
     (setvar "BLIPMODE" oldblip)
     (setvar "CMDECHO" oldecho)
     (setvar "OSMODE" oldsnap)

 (princ)

);defun c:q-plot

;;;*======================================================
(princ)

;CODING ENDS HERE

If you like, you can download the source coding here.

 
The AutoLisp/Visual Lisp/VBA Resource Website

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website