I have recently revised PlotDwgs to be easier to customize by other AutoCAD users and AutoCAD departments. This version utilizes two global lists, which are located at the top of the PlotDwgs.lsp file. The lists are easy to edit, even by a non-programmer. PlotDwgs doesn’t use or require previous page setups, or layout plotter configuration settings. This makes it ideal for batch plotting a folder of customer drawings or other engineering firms’ drawings. In the main dialog, by selecting “Varies” for the paper size, the program determines the correct paper size and corresponding plotter to use for each layout. This version also includes the option of plotting all open drawings.
In order to make this version work for most global AutoCAD departments, a few company specific functions were removed, such as a plot stamp function for title blocks, and a Bill of Material utility which updates an Excel spreadsheet for the database. The program may be customized to meet your requirements, such as turning on or off certain layers when plotting. For the International AutoCAD users that use metric page sizes, search and replace A-Size through D-Size with your page size names, and also edit the PaperSize function, and change the values of the Widest~ variables accordingly. PlotDwgs is designed to work with AutoCAD 2000 and up.
Terry,
Somehow I think you might be getting inundated with email from Cadalyst's latest posting of your batch plotting routine.
This looks like just what my company is looking for, since Autodesk has removed their batch plotting routine.
My only question is, where am I supposed to place all of my plotting information? I understand that I am supposed to change the *PlotterInfo@ and the *PlotStyles@ information, I just am not sure where that is.
Thank you for your time. I hope that I asked the right questions.
Near the top of the AutoLISP file PlotDwgs.lsp there is the area that you will need to customize for your AutoCAD departments.
The version that you have, has a list of the four Beatles in one of the AutoCAD departments. Use this example and copy it just below and start editing it for your own AutoCAD department. Also if you will scroll down just a little, there is a commented section explaining how to plot via the command line entries and remember what you entered, as certain values are needed to put into your *PlotterInfo@ and the *PlotStyles@ information lists. It might be helpful to just print out that section of the PlotDwgs.lsp file so you can review it as you are making changes. The beauty of this version is that you only need to make the changes in one area, near the top of the file. The previous version was hard-coded throughout the entire file, making it a nightmare to make changes.
Lucianno,
Here is the plot information that you supplied to me. Notice that the line ending with "\\\\servidor-01\\hp agrícola" is not the default in <brackets>. Is this typed correctly?
I have re-attached the PlotDwgs.lsp file again with your new lists and tested it on my computer and it works fine. Try loading it and type "PlotDwgs" instead of "PD" to run it. Be sure to delete the old C:\Temp\PlotDwgs.dat file before you begin.
Terry
Code:
Detailed plot configuration? [Yes/No] <No>: y
Enter a layout name or [?] <Model>:
Enter an output device name or [?] <None>: \\\\servidor-01\\hp agrícola
Enter paper size or [?] <A5>: a5
Enter paper units [Inches/Millimeters] <Millimeters>: m
Enter drawing orientation [Portrait/Landscape] <Portrait>: p
Plot upside down? [Yes/No] <No>: y
Enter plot area [Display/Extents/Limits/View/Window] <Display>: e
Enter plot scale (Plotted Millimeters=Drawing Units) or [Fit] <Fit>:
Enter plot offset (x,y) or [center] <11.55,-13.65>: Center
Plot with plot styles? [Yes/No] <Yes>:
Enter plot style table name or [?] (enter . for none) <>:
Plot with lineweights? [Yes/No] <Yes>:
Enter shade plot setting [As displayed/Wireframe/Hidden/Visual styles/Rendered] <As displayed>:
Write the plot to a file [Yes/No] <N>: n
Save changes to page setup [Yes/No]? <N> n
Proceed with plot [Yes/No] <Y>: y
Effective plotting area: 190.60 wide by 108.98 high
Plotting viewport 2.
Lucianno,
Here is the basic code you will need to plot a folder of drawings. You will need to customize the commented lines in the middle of the script per your requirements. Anyone can use this code to run any type of custom script on a folder of drawings by customizing those lines to include the programming code they want to execute.
Regards,
Terry
Code:
(defun c:PlotFolder (/ DwgName$ DwgPathName$ Filename% First FolderDwgs@)
(if (> (length (GetDwgsList)) 1)
(progn
(alert (strcat "This program can only be run if only one drawing is\n"
"open. Close all other open drawings and try again.")
);alert
(exit)
);progn
);if
(if (or (/= (getvar "DBMOD") 0)(= (getvar "DWGTITLED") 0))
(progn
(if (= (getvar "DWGTITLED") 0)
(alert "If you do not want to save the\ncurrent drawing select Cancel.")
);if
(initdia)
(command "QSAVE")
);progn
);if
(if (not *Foldername$)
(setq *Foldername$ (getvar "DWGPREFIX"))
);if
(if (setq DwgPathName$ (getfiled " Select a drawing in a folder to Plot Folder" *Foldername$ "dwg" 2))
(progn
(setq *Foldername$ (strcat (vl-filename-directory DwgPathName$) "\\"))
(setq FolderDwgs@ (vl-directory-files *Foldername$ "*.dwg" 1))
(if (not (findfile "C:\\Temp\\Temp.scr"))
(progn (vl-load-com)(vl-mkdir "C:\\Temp"))
);if
(setq Filename% (open "C:\\Temp\\Temp.scr" "w"))
(setq First t)
(foreach DwgName$ FolderDwgs@
(setq DwgPathName$ (strcat *Foldername$ DwgName$))
(write-line "FileOpen" Filename%)
(write-line (strcat "\"" DwgPathName$ "\"") Filename%)
(if First
(progn
(setq First nil)
(if (or (/= (getvar "DBMOD") 0)(= (getvar "DWGTITLED") 0))
(write-line "N" Filename%)
);if
);progn
);if
;Here you will add the code to plot your drawings. For example:
;For the Model tab
;(setq Text$ "(command \"-PLOT\" \"Y\" \"\" \"\\\\servidor-01\\hp agrícola\" \"A5\" \"M\" \"P\" \"Y\" \"E\" \"F\" \"C\" \"Y\" \"acad.ctb\" \"Y\" \"\" \"N\" \"N\" \"Y\")")
;For a Layout tab
;(setq Text$ "(command \"-PLOT\" \"Y\" \"\" \"\\\\servidor-01\\hp agrícola\" \"A5\" \"M\" \"P\" \"Y\" \"E\" \"F\" \"C\" \"Y\" \"acad.ctb\" \"Y\" \"N\" \"N\" \"N\" \"N\" \"N\" \"Y\")")
;(write-line Text$ Filename%)
(write-line "(if(/=(getvar\"DBMOD\")0)(command\"QSAVE\"))" Filename%)
);foreach
(if (findfile (strcat (getvar "DWGPREFIX") (getvar "DWGNAME")))
(progn
(write-line "FileOpen" Filename%)
(write-line (strcat "\"" (getvar "DWGPREFIX") (getvar "DWGNAME") "\"") Filename%)
);progn
);if
(close Filename%)
(command "SCRIPT" "C:\\Temp\\Temp.scr")
);progn
(exit)
);if
);defun
;-------------------------------------------------------------------------------
; GetDwgsList - Returns a list of open drawings
; Use (length (GetDwgsList)) for the number of open drawings.
;-------------------------------------------------------------------------------
(defun GetDwgsList (/ AcadOBJ DocsOBJ DwgsList@)
(if (>= (atoi (getvar "ACADVER")) 15)
(progn
(setq AcadOBJ (vlax-get-acad-object)
DocsOBJ (vlax-get-property AcadOBJ "Documents")
DwgsList@ nil
);setq
(vlax-for ForItem DocsOBJ
(setq DwgsList@ (cons (strcat (vlax-get-property ForItem "Path") "\\"
(vlax-get-property ForItem "Name")) DwgsList@))
);vlax-for
(setq DwgsList@ (reverse DwgsList@))
);progn
(setq DwgsList@ (list (strcat (getvar "DWGPREFIX") (getvar "DWGNAME"))))
);if
DwgsList@
);defun GetDwgsList
;-------------------------------------------------------------------------------
(princ)
Theodorus,
Here is the information that you sent me. When you type (strcase (getvar "LOGINNAME"))
on the command line does it return one of the names in the list below?
I will need you to plot at least two drawings of different sizes, using the "-PLOT" command.
Then save the information on the text screen and attach it to this thread.
It will look similar to the one Lucianno attached in this thread.
Regards,
Terry
Code:
(setq *LoginName$ (strcase (getvar "LOGINNAME")));LoginName in all caps
(cond;The Printer/Plotter name in each list must be different.
((member *LoginName$ (list "ALLA" "BILL" "JANELLE" "KIM" "MARY" "THEO" "TERRY"));AutoCAD department 1
(setq *PlotterInfo@ (list
(list "Printer" "Xerox WorkCentre Pro 255 PS 1" "\\\\is655\\PRT02446"
"A-Size" "Letter" "N" "C"
"B-Size" "11x17" "N" "C"
"A4-Size" "210x297" "N" "C")
(list "Printer" "Xerox WorkCentre Pro 255 PS 2" "\\\\is655\\PRT02377"
"A-Size" "Letter" "N" "C"
"B-Size" "11x17" "N" "C"
"A4-Size" "210x297" "N" "C")
(list "Printer" "HP LaserJet 8150 Series PS" "\\\\is655\\PRT02576"
"A-Size" "Letter" "N" "C"
"B-Size" "11x17" "N" "C"
"A4-Size" "210x297" "N" "C")
(list "Printer" "HP Color LaserJet 5550 PS" "\\\\is655\\PRT02131"
"A-Size" "Letter" "N" "C"
"B-Size" "11x17" "N" "C"
"A4-Size" "210x297" "N" "C")
(list "Plotter" "HP Designjet T1100 24in HPGL2" "\\\\is655\\PRT02585"
"C-Size" "Arch C - 17 x 22 in. (landscape)" "N" "C"
"D-Size" "Arch D - 22 x 34 in. (landscape)" "N" "C"
"A1-Size" "594x841 (landscape)" "N" "C"
"A2-Size" "420x594 (landscape)" "N" "C"
"A3-Size" "297x420 (landscape)" "N" "C")
));list;setq
(setq *PlotStyles@ (list "HP 1050C.ctb" "HP 5000N.ctb" "HP 5000 PS.ctb"))
);case
);cond
Command: -PLOT
Detailed plot configuration? [Yes/No] <No>: Y
Enter a layout name or [?] <S11X>:
Enter an output device name or [?] <\\is655\PRT02377>:
Enter paper size or [?] <Tabloid>:
Enter paper units [Inches/Millimeters] <Inches>:
Enter drawing orientation [Portrait/Landscape] <Landscape>:
Plot upside down? [Yes/No] <No>:
Enter plot area [Display/Extents/Layout/View/Window] <Extents>:
Enter plot scale (Plotted Inches=Drawing Units) or [Fit] <Fit>:
Enter plot offset (x,y) or [Center] <Center>:
Plot with plot styles? [Yes/No] <Yes>:
Enter plot style table name or [?] (enter . for none) <HP 5000N.ctb>:
Plot with lineweights? [Yes/No] <Yes>:
Scale lineweights with plot scale? [Yes/No] <No>:
Plot paper space first? [Yes/No] <No>: Y
Hide paperspace objects? [Yes/No] <No>:
Write the plot to a file [Yes/No] <N>:
Save changes to page setup [Yes/No]? <N> Y
Proceed with plot [Yes/No] <Y>:
Effective plotting area: 10.60 wide by 15.91 high
Plotting viewport 1.
Effective plotting area: 8.49 wide by 14.64 high
Hi Terry,
I see your lisp plotdwg and to configure my print for to test.
I received an error and (error: quit / exit abort) want verify with you how to fix.
I verify error happened in code :
(if (= Return# 0) (exit))
because it only return the value 0,
I think what it happen because the code:
(setq Return# (start_dialog))
is returning only the value 0 because is not loading
can you help about it dounts
Danneshi,
Can you please attach you modified version of PlotDwgs.lsp so I can debug the code on my computer. It's hard to say what might have caused the error without looking at everything.
By default the OK button returns a 1, and the Cancel button returns a 0.
Example code: (setq Return# (start_dialog))
You can bypass these defaults by using the following method.
(action_tile "accept" "(done_dialog 5)")
(action_tile "cancel" "(done_dialog 6)")
But I don't think this is the problem.