Search code examples
pythonautocadwin32comautolisp

How do you detect if AutoCAD is done plotting in AutoLISP


Is there a way to figure out if a plot job is still working in AutoLISP?

I am currently using the DWG To PDF.pc3 printer in a LISP script in AutoCAD 2007. Unfortunately, the vla-PlotToFile function returns immediately. I would like to automatically open the file upon completion of the plot.

If it helps, I am actually doing a lot of the coding outside of AutoCAD in Python, calling into it with win32com.

The code I currently have is:

(vla-PlotToFile (vla-get-Plot activeDocument) printing-filename "DWG To PDF.pc3")

That returns before AutoCAD has finished plotting.

I considered checking for the existence of the pdf file after that command, but often times, I write over that file, so it already exists before the command.


Solution

  • You need to turn off background plotting by setting the BACKGROUNDPLOT system variable to zero. See e.g. this blog post.