View Full Version : Auto name plot files
03xtreme
2006-03-21, 07:55 PM
We make plot files for all of printing
Auto Cad names the files
I'd like to make a lisp that allows me to put up to a 3 digit prefix before AutoCAD does anything for the plot file.
Cad uses the setup:
drawing-layout
I want to have a routine that allows me to over ride that and essentially add a 3 digit number before the "drawing-name" it is a waste of time to delete part of the file name after they are made, and too time consuming to plot each drawing and tab individually and edit each name.
scenario:
Cad file: Z-Base.dwg
Layout tab: EX-1, EX-2, EX-3
desired plot file name: 001-Z-Base-EX-1.plt, 002-Z-Base-EX-2.plt, 003-Z-Base-EX-3.plt
and i want to be able to pick a location to put the files before i make them
solution 2:
delete the "drawing" part out of the "drawing-layout" part of the plot process with a lisp or something else, I could just then number my layouts 001-EX-1, 002-EX-2, etc.
this place has been great to me so i figured you guys would have the know how!
thank you kindly, and my contour labeling tool is working great!!!! We love it!
BCrouse
2006-03-22, 12:49 AM
This could be done in what I think by using Rtext and Fields. We use something like you are describing with RText. We are going to moving towards fields here in the future. Please take a look at the file that i have attached. I am using the RText for the file name and the Rtext for the Sheet number. The Rtext file the file naming works great. It is set up to only read the file name. The Rtext that us used for the Sheet number is set up to read the Tab. So what you put in the tab, it is represented in the Sheet number.
I have also attached a dwf file and a plt file. If you look at the file name of both, it will read Attribute-34x22.dwf, Attribute-34x22.plt or Attribute-34x22.pdf. It takes the files name and combines it with the layout tab to create the file name for the dwf, plt or pdf.
I hope that this help you out.
Brad
03xtreme
2006-03-23, 07:02 PM
i'm using LDT2002 can't open it lol.
BCrouse
2006-03-23, 07:11 PM
i'm using LDT2002 can't open it lol.
Do you have express tools loaded? Are you able to read Rtext?
Use this for your file name RTEXT:
$(substr,$(getvar,"dwgname"),1,$(-,$(strlen,($(getvar,"dwgname"))),6))-$(getvar,"ctab") .
Use this for you sheet number so it reflects the Tab name:
$(getvar,"ctab")
if you have any questions please ask!
Brad
03xtreme
2006-04-18, 02:46 PM
rtext doesn't really solve the problem with the auto naming of plot files. i really want it to just not include the cad file name and make the layout based on what is written in the layout tab with out having to edit hundreds of plot file names every time i plot.
BCrouse
2006-04-18, 02:53 PM
rtext doesn't really solve the problem with the auto naming of plot files. i really want it to just not include the cad file name and make the layout based on what is written in the layout tab with out having to edit hundreds of plot file names every time i plot.
John,
Can you post a file in a dxf format so I can see what you are trying to do. Are you using dwf files for your plot files?
thank you,
Brad
ccowgill
2006-04-19, 11:11 AM
you can try this routine. It looks for a folder in your drawing's current directory called plots, then if there isn't one, it creates one and then plots to file based on the name of the layout tab. currently it is only set up to automatically plot to file if the layout tab begins with "SH" but that is how we do our plots, I give you full permission to modify it any way you need.
it is currently setup to redefine the plot command, to override it you can still type in _.PLOT
(command "undefine" "plot")
(defun C:PLOT (/ ss App Doc Dwgprops dname name file)
(vl-load-com)
;;===============================================
;; L o c a l F u n c t i o n s
;;===============================================
;; error function & Routine Exit
(defun *error* (msg)
(if
(not
(member
msg
'("console break"
"Function cancelled"
"quit / exit abort"
""
)
)
)
(princ (strcat "nError: " msg))
) ; endif
(restore_sys_vars) ; reset vars
)
;; Function to save system variables in global variable
;; call to function
;; (save_sys_vars '("CMDECHO" "FILEDIA"))
(defun save_sys_vars (lst)
(setq *sysvarlist* '())
(repeat (length lst)
(setq *sysvarlist*
(append *sysvarlist*
(list (list (car lst) (getvar (car lst))))
)
)
(setq lst (cdr lst))
)
)
;; Function to reset system variables
(defun restore_sys_vars ()
(repeat (length *sysvarlist*)
(setvar (caar *sysvarlist*) (cadar *sysvarlist*))
(setq *sysvarlist* (cdr *sysvarlist*))
)
)
(save_sys_vars '("CMDECHO" "FILEDIA"))
(setvar "cmdecho" 0)
(setvar "filedia" 0)
(setq App (vlax-Get-Acad-Object)
Doc (vla-Get-ActiveDocument App)
DwgProps (vla-Get-SummaryInfo Doc)
)
(setq dname (getvar "DWGPREFIX"))
(setq dir (strcat dname "PLOTS/"))
(vl-mkdir dir)
(setq extA (getvar "ctab"))
(if (wcmatch extA "SH*"); this is where you would change what it is looking for in the name
(progn
(setq file (strcat dir extA ".PLT"))
;you will have to make sure the following settings match your plot configuration.
(command "-PLOT" "y" ;Detailed plot configuration? [Yes/No] <No>: y
"" ;Enter a layout name or [?] <Layout1>:
"" ;Enter an output device name or [?] <All SIZES KIP PLOTTER.pc3>:
"User 1 (36.00 x 24.00 Inches)"
;Enter paper size or [?] <User 1 (36.00 x 24.00 Inches)>:
"" ;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] <Window>:
"" ;Enter lower left corner of window <-0.715381,-1.094228>:
"" ;Enter upper right corner of window <35.284619,22.905772>:
"" ;Enter plot scale (Plotted Inches=Drawing Units) or [Fit] <1:1>:
"" ;Enter plot offset (x,y) or [Center] <0.00,-0.00>:
"" ;Plot with plot styles? [Yes/No] <Yes>:
"" ;Enter plot style table name or [?] (enter . for none) <english.ctb>:
"" ;Plot with lineweights? [Yes/No] <Yes>:
"" ;Scale lineweights with plot scale? [Yes/No] <No>:
"" ;Plot paper space first? [Yes/No] <No>:
"" ;Hide paperspace objects? [Yes/No] <No>:
"y" ;Write the plot to a file [Yes/No] <N>: y
file ;Enter file name <maverickengineeringx5405RCp01001-Layout1.PLT (file://maverickengineeringx5405RCp01001-Layout1.PLT/)>:
"N" ;Save changes to page setup [Yes/No]? <N> n
"y" ;Proceed with plot [Yes/No] <Y>:
)
)
(progn
(initdia)
(command "_.PLOT")
)
)
(*error* "") ; reset sysvars
)
I would really prefer if this program worked with page setups so I could tell plot to load a page setup instead of answering all of the prompts. This would solve the problem that I have that it currently only works for the size specified. It also assumes that the plot window and everything else have already been setup.
rkmcswain
2006-04-19, 01:54 PM
scenario:
Cad file: Z-Base.dwg
Layout tab: EX-1, EX-2, EX-3
desired plot file name: 001-Z-Base-EX-1.plt, 002-Z-Base-EX-2.plt, 003-Z-Base-EX-3.plt
and i want to be able to pick a location to put the files before i make them
solution 2:
delete the "drawing" part out of the "drawing-layout" part of the plot process with a lisp or something else, I could just then number my layouts 001-EX-1, 002-EX-2, etc.
Rather than trying to intercept the plot routine, how about plotting as normal and then batch renaming the plot files?
tyeelaw13
2006-06-29, 07:09 PM
Here is a lisp routine i use to do what you want, but you will need to change the .pc3 file , paper size and the .ctb file names to match yours. You may also need to change the code from "w" through to "36.00000,24.0000". This is the part that is asking for the plot area, so if you need to change this to display, extents,limits or view, you can eliminate the "0.0000,0.000" "36.0000,24.0000" part entirely. If you want it to plot using the window you will need to make sure you enter what you want the window coords to be. If it's not a 1:1 scale plot, you will need to change that as well.
The best way to get all of this is to do a plot using the window and set it up the way you want it to be, then do a -plot and enter Y for the detailed plot configuration. Then press the enter button until it's complete. Then you can open the command history (F2 button) and just copy and paste those things into this routine.
Hope this works!
(DEFUN C: pltfile()(COMMAND "-plot" "y" "" "Oce 9400.pc3" "ARCH expand D (24.00 x 36.00 Inches)" "i" "L" "N" "W" "0.000000,0.000000" "36.000000,24.000000" "1:1" "C" "Y" "Pens - 24x36.ctb" "Y" "N" "N" "N" "Y" "~" "N" "Y"))
ps-remove the space betwee c: and pltfile in the lisp. I can't get it to go without giving me a smiley face sticking out it's tongue
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.