TA的每日心情 | 开心 6 小时前 |
---|
签到天数: 20 天 [LV.4]偶尔看看III
管理员
- 积分
- 1393
|
- void PlotDwgToPdf(PlotSettingInfo& plotSettingInfo)
- {
- // 设置系统变量BACKGROUNDPLOT
- SystemVar backgroudplot(采用T("BACKGROUNDPLOT"), 0);
- // 获取原视图
- BOOL bNeedRestoreView = FALSE;
- AcDbViewTableRecord viewOld;
- GetCurrentView(viewOld);
- AcPlPlotEngine* pEngine = NULL;
- if (Acad::eOk == AcPlPlotFactory::createPublishEngine(pEngine))
- {
- std::set<CString> setPlotFile;
- // Here is the progress dialog for the current plot process...
- AcPlPlotProgressDialog* pPlotProgDlg = acplCreatePlotProgressDialog(acedGetAcadFrame()->m采用hWnd, false, 1);
- pPlotProgDlg->setPlotMsgString(AcPlPlotProgressDialog::PlotMSGIndex::kDialogTitle, L"Plot API Progress");
- pPlotProgDlg->setPlotMsgString(AcPlPlotProgressDialog::PlotMSGIndex::kCancelJobBtnMsg, L"Cancel Job");
- pPlotProgDlg->setPlotMsgString(AcPlPlotProgressDialog::PlotMSGIndex::kCancelSheetBtnMsg, L"Cancel Sheet");
- pPlotProgDlg->setPlotMsgString(AcPlPlotProgressDialog::PlotMSGIndex::kSheetSetProgressCaption, L"Job Progress");
- pPlotProgDlg->setPlotMsgString(AcPlPlotProgressDialog::PlotMSGIndex::kSheetProgressCaption, L"Sheet Progress");
- pPlotProgDlg->setPlotProgressRange(0, 100);
- pPlotProgDlg->onBeginPlot();
- pPlotProgDlg->setIsVisible(true);
- int nDwgCount = plotSettingInfo.m采用vecBlockInfo4Plot.size();
- for (int num = 0; num < plotSettingInfo.m采用vecBlockInfo4Plot.size(); num++)
- {
- if (pPlotProgDlg->isPlotCancelled() || pPlotProgDlg->isSheetCancelled())
- {
- break;
- }
- CString csFilePathWithoutExt = plotSettingInfo.m采用csSaveLocation + 采用T("\") + CString(plotSettingInfo.m采用vecBlockInfo4Plot[num].m采用sPlotFileName.data());
- CString csDstPdf = GetNextFilePath(csFilePathWithoutExt, 采用T(".pdf"), 0, plotSettingInfo.m采用bOverride);
- CString csStatus;
- csStatus.Format(采用T("正在打印%d/%d..."), num + 1, nDwgCount);
- pPlotProgDlg->setPlotMsgString(AcPlPlotProgressDialog::PlotMSGIndex::kSheetName, csDstPdf);
- pPlotProgDlg->setPlotMsgString(AcPlPlotProgressDialog::PlotMSGIndex::kStatus, csStatus);
- AcPlPlotInfo plotInfo;
- SetPlotInfo(plotSettingInfo.m采用vecBlockInfo4Plot[num], plotSettingInfo.m采用idLayout, plotInfo);
- DoPlot(pPlotProgDlg, pEngine, plotInfo, true, csDstPdf);
- setPlotFile.insert(csDstPdf);
- //int nProgressPercent = (num + 1) * 100 / nDwgCount;
- pPlotProgDlg->setPlotProgressPos(100);
- }
- // Destroy the engine
- pEngine->destroy();
- pEngine = NULL;
- // and the progress dialog.
- pPlotProgDlg->destroy();
- pPlotProgDlg = NULL;
- }
- else
- {
- // Ensure the engine is not already busy...
- AfxMessageBox(L"Plot Engine is Busy...");
- }
- // 恢复视图
- if (bNeedRestoreView)
- {
- // 将视图对象设置为当前视图
- acedSetCurrentView(&viewOld, NULL);
- }
- }
复制代码 |
|