AutoCAD/autolisp plot
Expert: Bill DeShawn - 1/18/2008
QuestionQUESTION: I'm trying to create a script file that will sequentially open drawings, perform some AutoCAD functions, plot to PDF, save, close & open the next drawing.
With the statement:
(command "_plot" "y" "Acrobat Distiller" "" "" "" "" "E" ..
Adobe still asks for the name of the plot file. Is there a way in Autolisp to produce a PDF file without user specification of the file name & location?
ANSWER: Dave:
When it comes time to give the plot file name, use this:
(strcat (getvar "dwgname") "_" (getvar "CTAB"))
If you need to include the extension:
(strcat (getvar "dwgname") "_" (getvar "CTAB") ".pdf")
Let me know how it goes
Bill DeShawn
http://my.sterling.net/~bdeshawn
---------- FOLLOW-UP ----------
QUESTION: indeed you can get the drawing name, but this doesn't work when Adobe asks for the file name. I believe that AutoCAD (and hence Autolisp) passes control to Adobe when creating a PDF file. So the real question is "how can you create a PDF file witl Autolisp without user specification of the file name?"
Try this at the command: prompt and you'll see what I meanL
(command "_plot" "y" "" "Acrobat Distiller" "" "" "" "" "E" "" "" "" "" "" "" "" "" "" (getvar "dwgname"))
AnswerAt first it sounds like you want to create a PDF file that has no name. But that doesn't make sense. Perhaps if an AutoLISP routine could make a list of the PDF files in a folder and they had a sequence to them like Projectname-1, Projectname-2, Projectname-3, etc., and then from that could automatically create a name like Projectname-4 and so on. It can be done, I think, but for me to do it, it would take hours or days. I haven't done very much file manipulation via AutoLISP or VLISP, but I know where to read on it and could eventually come up with a method. Here's the flip side. I'm a family man, and my time is worth something. Most of the time, I can do simple routines for free. If I could do this fast, I would, but I can't. Besides, you'd probably like more control of how to name your files instead of -1, -2, etc.
One thing I can recommend that helps me tremendously and I know can help other LISPers is to download and use Robert McNeel's DOSLIB for the version of AutoCAD you are running. It has some file functions that you might be able to use.
What do you think?
Bill DeShawn
http://my.sterling.net/~bdeshawn