|
[code]void openDocHelper(void* pData)
{
if (acDocManager->isApplicationContext())
{
AcString* dwg = (AcString*)pData;
Acad::ErrorStatus result
= acDocManager->appContextOpenDocument(*dwg);
if (result != Acad::eOk)
acutPrintf(L"\nERROR: %s\n", acadErrorStatusText(result));
}
else
acutPrintf(L"\nERROR: in Document context :%s\n", acDocManager->curDocument()->fileName());
}
void OpenDwg()
{
Acad::ErrorStatus es;
AcString dwgpath = L"F:\\Project\\FactoryCAD\\data\\sample1.dwg";
if (acDocManager->isApplicationContext()) //if Command is registered for SESSION
{
es = acDocManager->appContextOpenDocument(dwgpath);
if (es != Acad::eOk)
acutPrintf(L"\nERROR: %s\n", acadErrorStatusText(es));
}
else //if COmmand is registered for MODAL only
acDocManager->executeInApplicationContext(openDocHelper, &dwgpath);
}
void CimfCommands::PrepareForImport()
{
OpenDwg();
return;
}[/code] |
|