找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 131|回复: 0

[每日一码] 通过ARX使用DSD创建多页PDF

[复制链接]

0

主题

0

回帖

28

积分

管理员

积分
28
发表于 2024-3-14 20:30:19 | 显示全部楼层 |阅读模式
  1. static void plot (AcDbDatabase *pDb)
  2. {
  3.   CString pdfPath = "C:\\temp\\pdf\\myPDF.pdf";
  4.   CString deviceName =  L"DWG To PDF.pc3";
  5.   Acad::ErrorStatus es = Acad::eOk;
  6.   const TCHAR *docName;
  7.   es = pDb->getFilename(docName);   
  8.   AcDbLayoutManager *layoutManager =
  9.     acdbHostApplicationServices()->layoutManager();
  10.   AcDbDictionary *layoutDict = NULL;
  11.   es = pDb->getLayoutDictionary(layoutDict, AcDb::OpenMode::kForRead);
  12.   // Start collecting info for the DSD data
  13.   AcPlDSDEntries dsdEntries;
  14.   AcDbDictionaryIterator *layoutIterator = layoutDict->newIterator();
  15.   // If we only want to plot paper spaces and not the model layout
  16.   AcDbObjectId msId = acdbSymUtil()->blockModelSpaceId(pDb);
  17.   for (; layoutIterator && !layoutIterator->done(); layoutIterator->next())
  18.   {
  19.     AcDbObjectPointer<AcDbLayout> layout(
  20.       layoutIterator->objectId(), AcDb::OpenMode::kForRead);
  21.     if (layout->getBlockTableRecordId() == msId)
  22.       continue;
  23.     const ACHAR *layoutName;
  24.     layout->getLayoutName(layoutName);
  25.     AcPlDSDEntry dsdEntry;
  26.     dsdEntry.setLayout(layoutName);
  27.     dsdEntry.setDwgName(docName);
  28.     dsdEntry.setTitle(layoutName);
  29.     dsdEntries.append(dsdEntry);     
  30.   }
  31.   delete layoutIterator;
  32.   layoutDict->close();
  33.   AcPlDSDData dsdData;
  34.   dsdData.setDSDEntries(dsdEntries);  
  35.   dsdData.setProjectPath(L"c:\\temp\\pdf\");
  36.   dsdData.setLogFilePath(L"c:\\temp\\pdf\\logdwf.log");
  37.   dsdData.setSheetType(AcPlDSDEntry::SheetType::kMultiPDF);
  38.   dsdData.setNoOfCopies(1);
  39.   dsdData.setDestinationName(pdfPath);
  40.   dsdData.setPromptForDwfName(false);
  41.   dsdData.setSheetSetName(L"PublisherSet");
  42.   AcPlPlotConfig *plotConfig;
  43.   acplPlotConfigManager->setCurrentConfig(plotConfig, deviceName);   
  44.   // We need this for acplPublishExecute
  45.   acedArxLoad(L"AcPublish.arx");
  46.   acplPublishExecute(dsdData, plotConfig, false);
  47. }
复制代码
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|膜结构网

GMT+8, 2024-12-29 04:57 , Processed in 0.172581 second(s), 23 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表