C# CAD2010 AcadApplication判断"DWG To PDF.pc3"打印机是否正在打印中
时间: 2023-12-10 09:37:28 浏览: 26
在C#中,可以通过以下代码来判断是否有正在打印中的打印任务:
```csharp
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
public static bool IsPrinting()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
if (doc == null) return false;
AcadApplication app = (AcadApplication)doc.AcadApplication;
if (app == null) return false;
AcadState state = app.GetAcadState();
if (state == null) return false;
foreach (AcadPlot plot in state.Plotting.PlotQueue)
{
if (plot.DeviceName.Contains("DWG To PDF.pc3") && plot.Status == AcadPlotStatus.acPlotStatusProcessing)
{
return true;
}
}
return false;
}
```
上述代码中,使用了AutoCAD的API来获取当前应用程序的状态,并遍历打印队列中的所有打印任务,判断是否有使用"DWG To PDF.pc3"打印机并处于打印中的任务。如果有,则返回true,否则返回false。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/msword](https://img-home.csdnimg.cn/images/20210720083327.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)