【转载】ARX如何得到当前CAD打印设备列表及其他打印设置内容
2013-04-14 13:31
1166 查看
#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("\nMedia Name:%s", mediaName);
char* styleSheetName;
pPlotSetting->getCurrentStyleSheet(styleSheetName);
acutPrintf("\nStyleSheet Name:%s", styleSheetName);
char* plotCfgname;
pPlotSetting->getPlotCfgName(plotCfgname); // Output pointer to name of configured system or PC3 plot device
acutPrintf("\nPlotCfg 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("\nPlot Configuration List :");
int nLength = mDeviceList.length();
char* localeName;
pPSV->getLocaleMediaName(pLayout, 0, localeName);
acutPrintf("\nCur Midia Name:%s", localeName);
pPlotSetting->close();
pLayout->close();
return;
for(int nCtr = 0;nCtr < nLength; nCtr++)
{
acutPrintf("\n %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("\nSelect the Plot Configuration number to list the Media names: ", &nSel);
if (nSel > nLength)
{
acutPrintf("\nEnter 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("\nMedia 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("\n %i)\n Name: %s \n Locale Name: %s ",(nCtr + 1),mMediaList.at(nCtr),pLocaleName);
}
mRes = RTNONE;
while(RTNORM != mRes)
{
acedInitGet((RSG_NONULL + RSG_NONEG + RSG_NOZERO),NULL);
mRes = acedGetInt("\nSelect the Media by entering the number: ", &nSel);
if (nSel > nLength)
{
acutPrintf("\nEnter 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("\nMedia Name:%s", mediaName);
char* styleSheetName;
pPlotSetting->getCurrentStyleSheet(styleSheetName);
acutPrintf("\nStyleSheet Name:%s", styleSheetName);
char* plotCfgname;
pPlotSetting->getPlotCfgName(plotCfgname); // Output pointer to name of configured system or PC3 plot device
acutPrintf("\nPlotCfg 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("\nPlot Configuration List :");
int nLength = mDeviceList.length();
char* localeName;
pPSV->getLocaleMediaName(pLayout, 0, localeName);
acutPrintf("\nCur Midia Name:%s", localeName);
pPlotSetting->close();
pLayout->close();
return;
for(int nCtr = 0;nCtr < nLength; nCtr++)
{
acutPrintf("\n %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("\nSelect the Plot Configuration number to list the Media names: ", &nSel);
if (nSel > nLength)
{
acutPrintf("\nEnter 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("\nMedia 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("\n %i)\n Name: %s \n Locale Name: %s ",(nCtr + 1),mMediaList.at(nCtr),pLocaleName);
}
mRes = RTNONE;
while(RTNORM != mRes)
{
acedInitGet((RSG_NONULL + RSG_NONEG + RSG_NOZERO),NULL);
mRes = acedGetInt("\nSelect the Media by entering the number: ", &nSel);
if (nSel > nLength)
{
acutPrintf("\nEnter 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程序直接设置当前视图为顶视图(底视图)等?
- [VB.NET]VB2005,DataGridView如何设置当前的单元格里的内容处于编辑状态.
- Excel中设置下拉列表的来源怎么选择其他工作表的内容
- 如何得到系统音频设备列表
- 如何在 Repeater 的事件中得到 当前 Item 绑定的数据 ---声明转载
- java如何得到GET和POST请求URL和参数列表(转载)
- apache如何设置才能取消将目录中的内容列表显示出来
- 如何得到ClistBox当前选择的内容,以及如何初始化CListBox.删除当前选择的内容
- 如何设置一个style做一个属性触发去改变其他的属性值<style的相关内容>?
- vc CListCtrl 如何判断列表中的内容是否被选中?如何获取CListCtrl当前选中的行
- Atitit 网络设备的自动发现机制 需求如下: 1、自动获取当前设备所在网段及当前与当前网段有连接的网段的所有IP,并判断出是哪类设备。如:服务器、交换机、防火墙等。 2、如何根据第1点得到的
- 如何将打印的CAD图纸设置成横向?
- unity中如何判断当前设备的语言是否为中文
- C++ 如何得到当前进程所占用的内存呢?【转】
- unity3D导出exe文件,总是有个设置窗口,来设置分辨率和其他参数。如何删除掉这一步?
- 关于安卓alertdialog你能用到的都在这里了(进出动画,显示位置,背景,设置内容,是否可以点击其他地方消失,屏幕不变暗)
- Mysql中如何设置日期字段默认值为当前日期
- 物联网平台机智云Android开源框架入门之旅(二)详细分析在设备列表的代码块,如何修改设备默认图片。