天气与日历 切换到窄版

 找回密码
 立即注册
中国膜结构网
十大进口膜材评选 十大国产膜材评选 十大膜结构设计评选 十大膜结构公司评选
查看: 174|回复: 0

[每日一码] ARX打印窗口内容到DWF文件

[复制链接]
  • TA的每日心情
    开心
    昨天 06:36
  • 签到天数: 15 天

    [LV.4]偶尔看看III

    105

    主题

    11

    回帖

    1308

    积分

    管理员

    积分
    1308
    QQ
    发表于 2024-3-14 20:19:38 | 显示全部楼层 |阅读模式
    1. #import "acax19ENU.tlb" no采用namespace
    2. #include "acaplmgr.h"
    3. static void ASDKTS66871采用PlotWindow采用COM采用testPlot(void)
    4. {
    5.   // Use ActiveX interface to get the application object
    6.   IAcadApplicationPtr pAcad = acedGetAcadWinApp()->GetIDispatch(FALSE);
    7.   //get the path to plotter configuration
    8.   采用bstr采用t szPrinterPath;
    9.   szPrinterPath = pAcad->Preferences->GetFiles()->GetPrinterConfigPath() + 采用bstr采用t("\\DWF6 ePlot.pc3");
    10.   // get the current database
    11.   AcDbDatabase *curDocDB = acdbHostApplicationServices()->workingDatabase();
    12.   // get a pointer to the layout manager
    13.   AcApLayoutManager *pLayoutManager = (AcApLayoutManager *)acdbHostApplicationServices()->layoutManager();
    14.   const ACHAR *layoutName = pLayoutManager->findActiveLayout (true);
    15.   // get the current layout
    16.   AcDbLayout *pLayout = pLayoutManager->findLayoutNamed (layoutName, true);
    17.   // if we got it ok
    18.   if (pLayout != NULL)
    19.   {
    20.     Acad::ErrorStatus es;
    21.     // get the plotsetttings class
    22.     AcDbPlotSettingsValidator *pPlotSettingsValidator = acdbHostApplicationServices()->plotSettingsValidator();
    23.     // if we got it ok
    24.     if (pPlotSettingsValidator != NULL)
    25.     {
    26.       // Refresh the layout lists in order to use it
    27.       pPlotSettingsValidator->refreshLists (pLayout);
    28.       // change the current layout plotter
    29.       es = pPlotSettingsValidator->setPlotCfgName (pLayout, szPrinterPath);
    30.       // set the window to plot as the extents of the drawing
    31.       es = pPlotSettingsValidator->setPlotWindowArea (pLayout,
    32.         curDocDB->extmin ().x,
    33.         curDocDB->extmin ().y,
    34.         curDocDB->extmax ().x,
    35.         curDocDB->extmax ().y);
    36.       // set the orgin
    37.       es = pPlotSettingsValidator->setPlotOrigin (pLayout,
    38.         curDocDB->extmin ().x,
    39.         curDocDB->extmin ().y);
    40.       // set to plot centred
    41.       es = pPlotSettingsValidator->setPlotCentered (pLayout, true);
    42.       // setup the plot type to window
    43.       es = pPlotSettingsValidator->setPlotType (pLayout, AcDbPlotSettings::kWindow);
    44.       // set the scale
    45.       es = pPlotSettingsValidator->setStdScaleType (pLayout, AcDbPlotSettings::StdScaleType::kScaleToFit);
    46.       // we have to close the layout here because the last parameter of
    47.       // findLayoutNamed is true, leave layout open
    48.       pLayout->close ();
    49.     }
    50.   }
    51.   // get the current document
    52.   IAcadDocumentPtr pDoc = pAcad->GetActiveDocument();
    53.   // create a plot object
    54.   IAcadPlotPtr pPlot = pDoc->GetPlot();
    55.   // lets plot
    56.   pPlot->PlotToFile("c:\\test.dwf", szPrinterPath);
    57. }
    复制代码

     

     

     

     

    [每日一码] ARX打印窗口内容到DWF文件
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|Archiver|中国膜结构网|中国膜结构协会|进口膜材|国产膜材|ETFE|PVDF|PTFE|设计|施工|安装|车棚|看台|污水池|中国膜结构网_中国空间膜结构协会

    GMT+8, 2024-11-1 13:38 , Processed in 0.144924 second(s), 28 queries .

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

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