|
在ARX中访问AutoCAD Automation接口
问题:
从中访问AutoCAD automation界面的正确方法是什么
在ARX对象中?
解答:
以下代码段显示了如何执行此操作:。
[code]void testSave ()
{
// get the Active Document interface and check to see
// if the current dwg has been saved
LPDISPATCH pAcadDisp = acedGetAcadWinApp()->GetIDispatch(TRUE);
if(pAcadDisp == NULL)
return false;
IAcadApplicationPtr IAcadApp(pAcadDisp);
IAcadDocumentPtr IAcadDoc;
if (FAILED(IAcadApp->get_ActiveDocument(&IAcadDoc)))
return false;
VARIANT_BOOL saved(VARIANT_FALSE);
if (FAILED(IAcadDoc->get_Saved(&saved)))
return false;
if (saved == VARIANT_FALSE)
IAcadDoc->Save();
return true;
}
[/code] |
|