AutoCAD/autolisp plot

Advertisement


Question
QUESTION: 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"))  

Answer
At 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

AutoCAD

All Answers


Answers by Expert:


Ask Experts

Volunteer


Bill DeShawn

Expertise

I can address all 2-D questions and some 3-D questions. I do programming in AutoLISP if it doesn`t involve solid modeling. I can also address menu customization issues and can help you find answers to questions I can`t answer by taking your question directly to Autodesk via their newsgroups.

Experience

I used to do electronic and mechanical design for a flat panel monitor manufacturer, and now I do architectural drafting for an architect. I did and do AutoLISP and menu customization and take pride in making my lisp routines to do the work exactly the way the client likes them done.

Publications
I had a routine published in CADENCE magazine (no longer in publication and taken over by CADALYST). Some of my routines are published on my website at http://my.sterling.net/~bdeshawn

©2012 About.com, a part of The New York Times Company. All rights reserved.