AutoCAD/autolisp

Advertisement


Question
i have 8 a4 sheets  in a drawing
i want to take pdf with autolisp
i had written as
(command "plot"      "y"      "model""Adobe PDF"       "a4"
     ""      "Portrait"
     "n"      "Window"
     ;LB   
     (list (+ (car lb)0) (+ (cadr lb)-3))
     RT
     "fit"
     "c"
     "Y"
     "monochrome.ctb"
     "n"
     ;"Asdisplayed:"
     "n"
     "n"
     "y"
    "y")
but every time it is asking me the drawing
how do i do it please  give me the solution

Answer
Vivek:  Whenever you present a question to us here at AllExperts, you need to tell us what versio of AutoCAD you are running, so that we can address your question more appropriately.  There is a semicolon in your code, and I am not understanding why it's there.  Semicolons are used to make the code behind it ineffective.
There are symbols in this code that without seeing the code that defines the symbol, it is difficult or impossible to decipher what the symbols represent.

I recommend the following:
In AutoCAD, use the -PLOT command (with the minus sign) to see exactly what steps to take in your code.  Write the code out to emulate the command exactly.  If there are any errors, try to address them one at a time.
Vivek:
You said, "it is adking me the drawing".  I think you mean it is asking you of a PDF file name.  That would be reasonable.  You can do that with if you are using layouts, but I see that you are using the Model Tab and plotting different windows in model space.  This is not normally accomplished like this.  You need to do this in paper space.  That way you can use AutoLISP to automatically make up a PDF file name based on the drawing name and the layout name.

However, one way to do this in model space is if you have eight windows to define, you can give each windows a name like "Window1", "Window2", etc. use that in the creation of your filename.  Like this:
(strcat (getvar "dwgname")"_Window1.pdf"), or (strcat (getvar "dwgname")"_Window2.pdf")
and do that for eight windows.

If you do this in a layout (paper space), it would look like this:
(strcat (getvar "dwgname") "_" (getvar "ctab") ".pdf")


Let me know how it goes:
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.