Jump to content

Need help with quick plot lisp

Recommended Posts


Hi all,

Can somebody guides where I am going wrong with this quick plot lisp.


(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 "Portable Network Graphics PNG.pc3")
     ;replace this with your ctb file
     (setq plstyle "WF-B&W.ctb")
     ;replace this with your default sheet size
     (setq plsize "User 1 (15000.00 x 8500.00 Pixels)")

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

     (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 \"Portable Network Graphics PNG.pc3\")")

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

     ;replace all sheet sizes to match yours
     (action_tile "rb5"
         "(setq plsize \"User 1 (15000.00 x 8500.00 Pixels)\")")
     (action_tile "rb6"
         "(setq plsize \"Sun Hi-Res (1600.00 x 1280.00 Pixels)\")")
     (action_tile "rb7"
         "(setq plsize \"Super VGA(600.00 x 800.00 Pixels)\")")
     (action_tile "rb8"
         "(setq plsize \"VGA (480.00 x 640.00 Pixels))\")")
     (action_tile "rb9"
         "(setq plsize \"Super XGA (1024.00 x 1280.00 Pixels)\")")
      (action_tile "cancel"
         "(done_dialog)(setq userclick nil)")
     (action_tile "accept"
         "(done_dialog) (setq userclick T)")

     ;start the dialog

     ;unload the dialog
     (unload_dialog dcl_id)

  ;if OK is selected
  (if userclick

    ;do the following

        ;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)")
            (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

       );if userclick1

  );if userclick

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


);defun c:q-plot



I want to use the custom plot style table (WF-B&W.ctb) and have created a plotter for directly plotting PNG files (Portable Network Graphics ).
This program should give options for different paper sizes and two plotters.

But I am getting the below error


error : quit / exit abort


Share this post

Link to post
Share on other sites

Did you copy the .DCL file from this site also (and ensure that the .lsp file can find it..?)


My guess is not and it's exiting on this line: 

(if (not (new_dialog "qplot" dcl_id) ) (exit))



Share this post

Link to post
Share on other sites

@rkmcswain Thanks for your help.
It is working great for PDF plot, although pdf plotted does not have same name as dwg. I want the pdf to be as same name and location as that of dwg file.
We tried to use this code for plotting PNG after adding our plotter and .ctb style but it is giving the below error.image.thumb.png.4c7eca66ec13d768599b3e9345d02f1d.png

Below is the code modified by me for plotting PNG

Share this post

Link to post
Share on other sites

Rather than having one plot routine I have multiple A3 A1 PDF JPG and just pick from menu which one to use, no user entry just works. The pdf is a plot range of layout tabs and uses dwg name. I have it set up for multiple floors using user names so goes to correct floor printer.


I am sure Maratovich will post you his link to a multi plot version.

Share this post

Link to post
Share on other sites

Thank you BIGAL 🍻


Akash :
Very much depends on the title block of the user.
Watch an example video (made for another user).

For an accurate answer and help - attach an example of your dwg file.


Share this post

Link to post
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...