天气与日历 切换到窄版

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

[每日一码] 如何得到当前CAD打印设备列表及其他打印设置内容

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

    [LV.4]偶尔看看III

    105

    主题

    11

    回帖

    1308

    积分

    管理员

    积分
    1308
    QQ
    发表于 2024-3-14 20:10:35 | 显示全部楼层 |阅读模式
    1. #include "dblayout.h"
    2. #include "acaplmgr.h"
    3. #include "dbplotsetval.h"
    4. #include "dbplotsettings.h"
    5. // This is command 'MPLOTS'
    6. void mplotzzmplots()
    7. {
    8.     AcApLayoutManager *pLayMan = NULL;
    9.     pLayMan = (AcApLayoutManager *) acdbHostApplicationServices()->layoutManager();
    10.     //get the active layout
    11.     AcDbLayout *pLayout = pLayMan->findLayoutNamed(pLayMan->findActiveLayout(TRUE),TRUE);
    12.     AcDbPlotSettings* pPlotSetting = (AcDbPlotSettings*)pLayout;
    13.     char* mediaName;
    14.     pPlotSetting->getCanonicalMediaName(mediaName);
    15.     acutPrintf(" Media Name:%s", mediaName);
    16.     char* styleSheetName;
    17.     pPlotSetting->getCurrentStyleSheet(styleSheetName);
    18.     acutPrintf(" StyleSheet Name:%s", styleSheetName);
    19.     char* plotCfgname;
    20.     pPlotSetting->getPlotCfgName(plotCfgname);          // Output pointer to name of configured system or PC3 plot device
    21.     acutPrintf(" PlotCfg Name:%s", plotCfgname);
    22.     //get the PlotSettingsValidator
    23.     AcDbPlotSettingsValidator *pPSV =NULL;
    24.     pPSV = acdbHostApplicationServices()->plotSettingsValidator();
    25.     //refresh the Plot Config list
    26.     pPSV->refreshLists(pLayout);
    27.     //get all the Plot Configurations
    28.     AcArray< const char * > mDeviceList;
    29.     pPSV->plotDeviceList(mDeviceList);
    30.     acutPrintf(" Plot Configuration List :");
    31.     int nLength = mDeviceList.length();
    32.     char* localeName;
    33.     pPSV->getLocaleMediaName(pLayout, 0, localeName);
    34.     acutPrintf(" Cur Midia Name:%s", localeName);
    35.     pPlotSetting->close();
    36.     pLayout->close();
    37.     return;
    38.     for(int nCtr = 0;nCtr < nLength; nCtr++)
    39.     {
    40.             acutPrintf("  %i) - %s",(nCtr + 1), mDeviceList.at(nCtr));
    41.     }
    42.     //get the user input for listing the Media Names
    43.     int nSel;
    44.     int mRes =  RTNONE;
    45.     while(RTNORM != mRes)
    46.     {
    47.             acedInitGet((RSG采用NONULL + RSG采用NONEG + RSG采用NOZERO),NULL);
    48.             mRes = acedGetInt(" Select the Plot Configuration number to list the Media names: ", &nSel);
    49.             if (nSel > nLength)
    50.             {
    51.                     acutPrintf(" Enter a number between 1 to %i",nLength);
    52.                     mRes = RTNONE;
    53.             }
    54.     }
    55.     //select the selected Plot configuration
    56.     pPSV->setPlotCfgName(pLayout,mDeviceList.at(--nSel));
    57.     //list all the paper sizes in the given Plot configuration
    58.     AcArray< const char * > mMediaList;
    59.     const char *pLocaleName;
    60.     pPSV->canonicalMediaNameList(pLayout,mMediaList);
    61.     acutPrintf(" Media list for Plot Configuration - %s:",mDeviceList.at(nSel));
    62.     nLength = mMediaList.length();
    63.     for(nCtr = 0;nCtr < nLength; nCtr++)
    64.     {
    65.             //get the localename
    66.             pPSV->getLocaleMediaName(pLayout,mMediaList.at(nCtr),pLocaleName);
    67.             acutPrintf("  %i)    Name:  %s     Locale Name: %s ",(nCtr + 1),mMediaList.at(nCtr),pLocaleName);
    68.     }
    69.     mRes =  RTNONE;
    70.     while(RTNORM != mRes)
    71.     {
    72.             acedInitGet((RSG采用NONULL + RSG采用NONEG + RSG采用NOZERO),NULL);
    73.             mRes = acedGetInt(" Select the Media by entering the number: ", &nSel);
    74.             if (nSel > nLength)
    75.             {
    76.                     acutPrintf(" Enter a number between 1 to %i",nLength);
    77.                     mRes = RTNONE;
    78.             }
    79.     }
    80.     //set selected Media for the layout
    81.     pPSV->setCanonicalMediaName(pLayout,mMediaList.at(--nSel));
    82.     pLayout->close();
    83. }
    复制代码

     

     

     

     

    [每日一码] 如何得到当前CAD打印设备列表及其他打印设置内容
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

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

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

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

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