Jump to content

Lisp to Plot All Layouts Malfunctioning


mwade93

Recommended Posts

I am working on a computer at the office with full AutoCAD on it and I am trying to write a LISP routine for people that have the ability to use it. However, the actual plotting part of it is not working. I can get the PDF part to work, here is where the issue is:

 

(defun c:DPA ()
(foreach lay (layoutlist)
 (setvar 'CTab lay)
 (COMMAND  "-plot"
 "y"
 ""
 "FED.pc3"
 "Letter"
 "Inches"
 "Landscape"
 "n"
 "Extents"
 "1=1"
 "Center"
 "y"
 "don.ctb"
 "y"
 "n"
 "n"
 "n"
 "n"
 "y"      )
   )
)

 

I have not done LISP in about a year, my first attempt at the office. Thanks for the help.

Link to comment
Share on other sites

  • Replies 30
  • Created
  • Last Reply

Top Posters In This Topic

  • tmelancon

    10

  • MSasu

    9

  • mwade93

    5

  • Snownut

    3

Most probably there is an icorrect input. Is that FED.pc3 configuration available and valid?

Please make sure that CMDECHO system variable is set to 1 and run your code; when fails press to see where it failed and why.

To ensure that all inputs were the right ones, call the -PRINT (that it, the prompter version) command and note down the required answers.

Link to comment
Share on other sites

Most probably there is an icorrect input. Is that FED.pc3 configuration available and valid?

Please make sure that CMDECHO system variable is set to 1 and run your code; when fails press to see where it failed and why.

To ensure that all inputs were the right ones, call the -PRINT (that it, the prompter version) command and note down the required answers.

 

The pc3 file is available. I have an identical format one for PDFs that work perfectly fine. Mostafa, that is the one I used actually. For pdfs it works perfect, for actual paper plotting, not so much as of yet.

Link to comment
Share on other sites

Seem that you need to just add an answer to the last prompt!

 

...
"n"
"n"
"y"
[color=red]"y"[/color] )
)
)

 

Let me try that again. I already tried that once.

Link to comment
Share on other sites

I find this useful at my office. However, what should be added to the end if I wanted to switch back to modelspace, save, then close out of the drawing. All using this same routine. Thanks guys.

Link to comment
Share on other sites

However, what should be added to the end if I wanted to switch back to modelspace, save, then close out of the drawing.

I suppose that this a question, so you are looking for something like this:

(setvar "CTAB" "MODEL")
(if (= (getvar "DWGTITLED") 1)
(command "_QSAVE" "_CLOSE")
)

Link to comment
Share on other sites

I just tried it and although it printed all of them properly, it went back to Layout 1. It didnt switch back to model, save and close. Here is what I have:

 

(defun c:DPA ()
(foreach lay (layoutlist)
 (setvar 'CTab lay)
 (COMMAND  "-plot"
 "n"
 "Drawing1"
 ""
 "Brother HL-5370DW series"
 "n"
 "n"
 "y"     )
   )
)
(setvar "CTAB" "MODEL")
(if (= (getvar "DWGTITLED") 1)
(command "_QSAVE" "_CLOSE")
)

 

Seems funny looking.

Link to comment
Share on other sites

Update: I ran the code and it simply printed Layout1 over and over again. Then stayed on Layout1. I need it to print all layouts then switch back to model, close, and save. Some drawings have on 1 layout while others have 8. Can you help?

Link to comment
Share on other sites

Please pay attention that you placed the code I suggested outside DPA command definition, so, it will not be executed. Although, I'm not sure what make it look "funny".

Link to comment
Share on other sites

Thats it! I knew something looked "funny". Meaning it just didnt look right. I have now moved it into the definition and just tested it. Although, it is still not printing all the layouts. I need to lisp to look for and plot however many may be in any given drawing. Some have 3 layouts, others have 8.

Link to comment
Share on other sites

Although, it is still not printing all the layouts.

Seems that you are forcing the plot of a layout named "Drawing1"; please consider using "" ( to plot current one) or the lay variable instead:

...
(setvar 'CTab lay)
(COMMAND "-plot"
        "n"
        [color=red][s]"Drawing1"[/s] ""[/color]
...

Link to comment
Share on other sites

Last time I will bug you MSasu. The code works just as I would like but is only plotting the first layout. Can you doctor the code please?

 

(defun c:DPA ()
(foreach lay (layoutlist)
 (setvar 'CTab lay)
 (COMMAND  "-plot"
 "n"
 ""
 ""
 "Brother HL-5370DW series"
 "n"
 "n"
 "y"     )
(COMMAND "CTAB" "MODEL")
(command "_QSAVE" "_CLOSE")
   )
)

 

thanks a bunch!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...