AcDbLayoutManager::setCurrentLayoutId function.
This function makes the AcDbLayout object associated with the given AcDbObjectId the current layout in the active database.
Is there any way to set acitive layout in some unacive database?
Solved! Go to Solution.
Solved by Balaji_Ram. Go to Solution.
Hi,
You can try using the second parameter of the "setCurrentLayout" method which is a database pointer.
Here is a sample code :
<code>
Acad::ErrorStatus es = Acad::eOk;
AcDbDatabase *pDb = new AcDbDatabase (false, false);
pDb->readDwgFile (_T("C:\\Temp\\Test.dwg")) ;
AcApLayoutManager *pLayoutMngr =(AcApLayoutManager*)(acdbHostApplicationServices()->layoutManager());
pLayoutMngr->setCurrentLayout(ACRX_T("MyLayout"), pDb);
pDb->saveAs(_T("C:/Temp/Test1.dwg"));
delete pDb;
</code>
Thanks Balaji.
The function
Acad::ErrorStatus setCurrentLayout( const ACHAR * newname, AcDbDatabase* pDb = NULL )
is undocumented in AutoCAD 2008;
Is it available in AutoCAD 2008?
BTW: It works in AutoCAD 2012. Thanks again.
Can't find what you're looking for? Ask the community or share your knowledge.