static void cloneLayout()
{
Acad::ErrorStatus es;
AcDbDatabase *curDocDB =acdbHostApplicationServices()->workingDatabase();
AcApLayoutManager *layoutMngr =
(AcApLayoutManager*)(acdbHostApplicationServices()->layoutManager());
curDocDB->setTilemode(Adesk::kFalse);
const ACHAR *actLayoutName = layoutMngr->findActiveTab();
ACHAR *cloneName = layoutMngr->getNextNewLayoutName();
AcDbLayout *psrc=layoutMngr->findLayoutNamed(actLayoutName, TRUE);
if (psrc== NULL)
{
acutDelString(cloneName);
return;
}
es = layoutMngr->cloneLayout(pSrc, cloneName);
acutDelString(cloneName);
pSrc->close();
if (es == Acad::eOk)
layoutMngr->updateLayoutTabs();
}
I was tring to clone a layout to a new one. But I am suprised to find that all layers is copied but the order of some objects is changed.
old layerout:
new layerout:
Some objects above go behind