ObjectARX

Reply
Active Member
Posts: 10
Registered: ‎05-16-2012
Message 1 of 4 (179 Views)
Accepted Solution

How to set a layout active?

179 Views, 3 Replies
09-03-2013 02:02 AM

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?

 

ADN Support Specialist
Balaji_Ram
Posts: 609
Registered: ‎03-21-2011
Message 2 of 4 (148 Views)

Re: How to set a layout active?

09-05-2013 03:21 AM 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

Active Member
Posts: 10
Registered: ‎05-16-2012
Message 3 of 4 (137 Views)

Re: How to set a layout active?

09-06-2013 03:05 AM 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.

Employee
artc2
Posts: 184
Registered: ‎06-08-2010
Message 4 of 4 (130 Views)

Re: How to set a layout active?

09-06-2013 10:03 AM in reply to: chunyuran

The database argument was added in AutoCAD 2010.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community