ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to set a layout active?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
chunyuran
870 Views, 3 Replies

How to set a layout active?

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?

 

3 REPLIES 3
Message 2 of 4
Balaji_Ram
in reply to: chunyuran

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>

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 3 of 4
chunyuran
in reply to: Balaji_Ram

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.

Message 4 of 4
artc2
in reply to: chunyuran

The database argument was added in AutoCAD 2010.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

”Boost