//-----------------------------------------------------------------------------
//----- acrxEntryPoint.cpp
//-----------------------------------------------------------------------------
#include "StdAfx.h"
#include "axlock.h"
#include "resource.h"
//-----------------------------------------------------------------------------
#define szRDS _RXST("")
//-----------------------------------------------------------------------------
//----- ObjectARX EntryPoint
class CTestSetLayoutApp : public AcRxArxApp {
public:
CTestSetLayoutApp() : AcRxArxApp() {}
virtual AcRx::AppRetCode On_kInitAppMsg(void *pkt) {
AcRx::AppRetCode retCode = AcRxArxApp::On_kInitAppMsg(pkt);
return (retCode);
}
virtual AcRx::AppRetCode On_kUnloadAppMsg(void *pkt) {
AcRx::AppRetCode retCode = AcRxArxApp::On_kUnloadAppMsg(pkt);
return (retCode);
}
virtual void RegisterServerComponents() { }
static void RivilisSetNextLayout() {
Acad::ErrorStatus es;
AcDbDatabase *db = acdbHostApplicationServices()->workingDatabase();
AcApLayoutManager *pLayoutMngr = dynamic_cast<AcApLayoutManager *>(acdbHostApplicationServices()->layoutManager());
AcAxDocLock loc(db);
if (pLayoutMngr != NULL)
{
AcDbObject *pObj;
ACHAR *pLayName;
AcDbDictionary *pDict = NULL;
if (Acad::eOk == db->getLayoutDictionary(pDict, AcDb::kForRead))
{
AcDbDictionaryIterator *pIter = pDict->newIterator();
pDict->close();
//Iterate through all the items in the dictionary
for (; !pIter->done(); pIter->next())
{
pIter->getObject(pObj, AcDb::kForRead);
AcDbLayout *pLayout = AcDbLayout::cast(pObj);
es = pLayout->getLayoutName(pLayName);
pLayout->close();
pLayoutMngr->setCurrentLayout(pLayName);
pLayoutMngr->updateLayoutTabs();
const ACHAR * st = pLayoutMngr->findActiveLayout(Adesk::kTrue);
acutPrintf(L"\nActiveLayout=%s\n", st);
}
}
}
}
};
//-----------------------------------------------------------------------------
IMPLEMENT_ARX_ENTRYPOINT(CTestSetLayoutApp)
ACED_ARXCOMMAND_ENTRY_AUTO(CTestSetLayoutApp, Rivilis, SetNextLayout, SetNextLayout, ACRX_CMD_SESSION, NULL)