[ARX]如何得到当前CAD打印设备列表及其他打印设置内容
来源:互联网 发布:最好的期货软件 知乎 编辑:程序博客网 时间:2024/05/01 13:02
#include "dblayout.h"
#include "acaplmgr.h"
#include "dbplotsetval.h"
#include "dbplotsettings.h"
/**//*
To query the all the available plot configurations you should use plotDeviceList()
method of AcDbPlotSettingsValidator class.
And to get the list of available media names for a given plot configuration,
use canonicalMediaNameList() method AcDbPlotSettingsValidator class.
But note the media names may not be same as listed in the Plot dialog.
So to get the media name as listed in the drop down list,
supply the media name to the function getLocaleMediaName().
The sample code below lists the available plot configurations and asks the user to select one.
After user enters his choice, all the available media are listed and user can select one to set it current.
Please use ObjectARX Wizard to create an ARX project and call the function () from a user defined function.
Make sure that you are *not* registering the command using ACRX_CMD_SESSION.
*/
// This is command 'MPLOTS'
void mplotzzmplots()
...{
AcApLayoutManager *pLayMan = NULL;
pLayMan = (AcApLayoutManager *) acdbHostApplicationServices()->layoutManager();
//get the active layout
AcDbLayout *pLayout = pLayMan->findLayoutNamed(pLayMan->findActiveLayout(TRUE),TRUE);
AcDbPlotSettings* pPlotSetting = (AcDbPlotSettings*)pLayout;
char* mediaName;
pPlotSetting->getCanonicalMediaName(mediaName);
acutPrintf(" Media Name:%s", mediaName);
char* styleSheetName;
pPlotSetting->getCurrentStyleSheet(styleSheetName);
acutPrintf(" StyleSheet Name:%s", styleSheetName);
char* plotCfgname;
pPlotSetting->getPlotCfgName(plotCfgname); // Output pointer to name of configured system or PC3 plot device
acutPrintf(" PlotCfg Name:%s", plotCfgname);
//get the PlotSettingsValidator
AcDbPlotSettingsValidator *pPSV =NULL;
pPSV = acdbHostApplicationServices()->plotSettingsValidator();
//refresh the Plot Config list
pPSV->refreshLists(pLayout);
//get all the Plot Configurations
AcArray< const char * > mDeviceList;
pPSV->plotDeviceList(mDeviceList);
acutPrintf(" Plot Configuration List :");
int nLength = mDeviceList.length();
char* localeName;
pPSV->getLocaleMediaName(pLayout, 0, localeName);
acutPrintf(" Cur Midia Name:%s", localeName);
pPlotSetting->close();
pLayout->close();
return;
for(int nCtr = 0;nCtr < nLength; nCtr++)
...{
acutPrintf(" %i) - %s",(nCtr + 1), mDeviceList.at(nCtr));
}
//get the user input for listing the Media Names
int nSel;
int mRes = RTNONE;
while(RTNORM != mRes)
...{
acedInitGet((RSG_NONULL + RSG_NONEG + RSG_NOZERO),NULL);
mRes = acedGetInt(" Select the Plot Configuration number to list the Media names: ", &nSel);
if (nSel > nLength)
...{
acutPrintf(" Enter a number between 1 to %i",nLength);
mRes = RTNONE;
}
}
//select the selected Plot configuration
pPSV->setPlotCfgName(pLayout,mDeviceList.at(--nSel));
//list all the paper sizes in the given Plot configuration
AcArray< const char * > mMediaList;
const char *pLocaleName;
pPSV->canonicalMediaNameList(pLayout,mMediaList);
acutPrintf(" Media list for Plot Configuration - %s:",mDeviceList.at(nSel));
nLength = mMediaList.length();
for(nCtr = 0;nCtr < nLength; nCtr++)
...{
//get the localename
pPSV->getLocaleMediaName(pLayout,mMediaList.at(nCtr),pLocaleName);
acutPrintf(" %i) Name: %s Locale Name: %s ",(nCtr + 1),mMediaList.at(nCtr),pLocaleName);
}
mRes = RTNONE;
while(RTNORM != mRes)
...{
acedInitGet((RSG_NONULL + RSG_NONEG + RSG_NOZERO),NULL);
mRes = acedGetInt(" Select the Media by entering the number: ", &nSel);
if (nSel > nLength)
...{
acutPrintf(" Enter a number between 1 to %i",nLength);
mRes = RTNONE;
}
}
//set selected Media for the layout
pPSV->setCanonicalMediaName(pLayout,mMediaList.at(--nSel));
pLayout->close();
}
#include "acaplmgr.h"
#include "dbplotsetval.h"
#include "dbplotsettings.h"
/**//*
To query the all the available plot configurations you should use plotDeviceList()
method of AcDbPlotSettingsValidator class.
And to get the list of available media names for a given plot configuration,
use canonicalMediaNameList() method AcDbPlotSettingsValidator class.
But note the media names may not be same as listed in the Plot dialog.
So to get the media name as listed in the drop down list,
supply the media name to the function getLocaleMediaName().
The sample code below lists the available plot configurations and asks the user to select one.
After user enters his choice, all the available media are listed and user can select one to set it current.
Please use ObjectARX Wizard to create an ARX project and call the function () from a user defined function.
Make sure that you are *not* registering the command using ACRX_CMD_SESSION.
*/
// This is command 'MPLOTS'
void mplotzzmplots()
...{
AcApLayoutManager *pLayMan = NULL;
pLayMan = (AcApLayoutManager *) acdbHostApplicationServices()->layoutManager();
//get the active layout
AcDbLayout *pLayout = pLayMan->findLayoutNamed(pLayMan->findActiveLayout(TRUE),TRUE);
AcDbPlotSettings* pPlotSetting = (AcDbPlotSettings*)pLayout;
char* mediaName;
pPlotSetting->getCanonicalMediaName(mediaName);
acutPrintf(" Media Name:%s", mediaName);
char* styleSheetName;
pPlotSetting->getCurrentStyleSheet(styleSheetName);
acutPrintf(" StyleSheet Name:%s", styleSheetName);
char* plotCfgname;
pPlotSetting->getPlotCfgName(plotCfgname); // Output pointer to name of configured system or PC3 plot device
acutPrintf(" PlotCfg Name:%s", plotCfgname);
//get the PlotSettingsValidator
AcDbPlotSettingsValidator *pPSV =NULL;
pPSV = acdbHostApplicationServices()->plotSettingsValidator();
//refresh the Plot Config list
pPSV->refreshLists(pLayout);
//get all the Plot Configurations
AcArray< const char * > mDeviceList;
pPSV->plotDeviceList(mDeviceList);
acutPrintf(" Plot Configuration List :");
int nLength = mDeviceList.length();
char* localeName;
pPSV->getLocaleMediaName(pLayout, 0, localeName);
acutPrintf(" Cur Midia Name:%s", localeName);
pPlotSetting->close();
pLayout->close();
return;
for(int nCtr = 0;nCtr < nLength; nCtr++)
...{
acutPrintf(" %i) - %s",(nCtr + 1), mDeviceList.at(nCtr));
}
//get the user input for listing the Media Names
int nSel;
int mRes = RTNONE;
while(RTNORM != mRes)
...{
acedInitGet((RSG_NONULL + RSG_NONEG + RSG_NOZERO),NULL);
mRes = acedGetInt(" Select the Plot Configuration number to list the Media names: ", &nSel);
if (nSel > nLength)
...{
acutPrintf(" Enter a number between 1 to %i",nLength);
mRes = RTNONE;
}
}
//select the selected Plot configuration
pPSV->setPlotCfgName(pLayout,mDeviceList.at(--nSel));
//list all the paper sizes in the given Plot configuration
AcArray< const char * > mMediaList;
const char *pLocaleName;
pPSV->canonicalMediaNameList(pLayout,mMediaList);
acutPrintf(" Media list for Plot Configuration - %s:",mDeviceList.at(nSel));
nLength = mMediaList.length();
for(nCtr = 0;nCtr < nLength; nCtr++)
...{
//get the localename
pPSV->getLocaleMediaName(pLayout,mMediaList.at(nCtr),pLocaleName);
acutPrintf(" %i) Name: %s Locale Name: %s ",(nCtr + 1),mMediaList.at(nCtr),pLocaleName);
}
mRes = RTNONE;
while(RTNORM != mRes)
...{
acedInitGet((RSG_NONULL + RSG_NONEG + RSG_NOZERO),NULL);
mRes = acedGetInt(" Select the Media by entering the number: ", &nSel);
if (nSel > nLength)
...{
acutPrintf(" Enter a number between 1 to %i",nLength);
mRes = RTNONE;
}
}
//set selected Media for the layout
pPSV->setCanonicalMediaName(pLayout,mMediaList.at(--nSel));
pLayout->close();
}
- [ARX]如何得到当前CAD打印设备列表及其他打印设置内容
- 如何得到当前CAD打印设备列表及其他打印设置内容
- ARX的CAD打印程序开发
- ARX 中设置CAD 字体
- ARX 中设置CAD 字体
- 如何打印当前窗体
- 如何设置打印方向
- 如何设置打印页边距
- web 打印当前页面其中一部分内容
- JS调用word打印当前表单内容
- 如何打印IFRAME中的内容
- zwcad获取打印样式和打印设备(如果是CAD,将zw换成ac即可)
- 得到ARX程序当前的路径
- 如何批量打印CAD圖紙?(如有小程序,請賜予)
- ARX如何切换当前数据库文件
- IE打印控件使用及其他常用Windows事件
- 打印时隐藏按钮及其他信息方法
- javascript打印-打印页面设置-打印预览代码,特定内容的部分打印技术
- DataGrid应用
- 树和自联表(四)
- 关于正版软件的使用
- Openlaszlo配合struts开发RIA常见的几个问题整理
- 简单实现生产者、消费者模型
- [ARX]如何得到当前CAD打印设备列表及其他打印设置内容
- 测试以下我的搏客
- 实用的生活小秘方.
- 删除数据库中对应的图片!
- 11月7#8#
- setmessage()&postmessage()
- nutch0.7.2+ictclas 成功移植到linux下。
- 计算某天是星期几【C代码】
- 基于Visual C++6.0的DLL编程实现