PDA

View Full Version : PDF plot w/lisp and script



jeff.smith
2008-04-09, 04:11 PM
I am trying to figure the best way to do this. I have created a lisp file that creates a script file to plot to PDF files. The program works great except sometimes I may be in one directory and will run the program in another directory. The script file will be where I want it to be but when I run the script it will place the PDF in the directory I happen to be working in which is where I don't want it to be. Can anyone suggest how to "make" the files where the drawings are?

Thanks

ccowgill
2008-04-10, 02:38 PM
I am not familiar with creating and working with scripts. We use a LISP routine that plots to file in a particular location. The path for the plot files is based on the current drawing that is opened's dwgprefix. I am trying to develop a batch plot to file that automatically names per our company standard, but it isnt very high on my to do list.

jeff.smith
2008-04-11, 03:15 PM
Would you mind sharing with me?

irneb
2008-04-12, 06:44 AM
As you've stated you've got this "script" created through lisp. In which case you're probably creating the SCR file through the use of the (getvar "DWGNAME"), (getvar "DWGPREFIX") and (vl-filname-.....) functions. Now use the same when stating the PLT/PDF (or whatever) filename in the script.

E.g. to take the current drawing's folder & filename an place in the script you'd use:

(setq pdfname (strcat
(getvar "DWGPREFIX")
(vl-filename-base (getvar "DWGNAME"))
".PDF"))

Then at the correct place you'd do the following to write this to the SCR:
(write-line pdfname scrfile)

BTW you could place this LISP code into a standard SCR file. Then simply use ScriptPro to run this "PlotPDF.SCR" script for several drawings without needing user intervention for each.

irneb
2008-04-12, 06:54 AM
I am not familiar with creating and working with scripts. We use a LISP routine that plots to file in a particular location. The path for the plot files is based on the current drawing that is opened's dwgprefix. I am trying to develop a batch plot to file that automatically names per our company standard, but it isnt very high on my to do list.
You'd create a SCR file containing the following:
(load "YourLispForPlottingToPDF")
YourCommandForPlottingToPDF
The you'd use ScriptPro - just check the AutoDesk site, it's a free download. Select the SCR file you've created above, then add the drawings you want this applied to. Save the "project" so you don't need to do this again - if you want to redo the PDFs at a later stage. Then click the "Run this project" button ... go make yourself some coffee / have a smoke ... this now opens each DWG in turn & runs that SCR as if you've typed it into the command prompt - then it closes that file & opens the next. At the end it offers you a log of what has happened so you can scan of any errors.