|
[code]int Commonlib::CreateNewDwg()
{
CString acadPath;
GetAcadPath(acadPath);//得到CAD路径
CString t = "acadiso.dwt";
t.Format("%s//Template//acadiso.dwt",acadPath);
acDocManager->appContextNewDocument(t.LockBuffer());
return 1;
}[/code]
但经过调试,es 的返回值是:eNotApplicable,没有成功的建立一个文档
解决方法是:
就是注册命令的时候加上ACRX_CMD_SESSION,防止CAD自动锁定到当前文档
[code]void InitApplication()
{
// NOTE: DO NOT edit the following lines.
//{{AFX_ARX_INIT
AddCommand("TESTTESTCOMMAND", "TEST", "TEST", ACRX_CMD_TRANSPARENT | ACRX_CMD_USEPICKSET|ACRX_CMD_SESSION, testCommand);
//}}AFX_ARX_INIT
// TODO: add your initialization functions
}[/code] |
|