ARX清理layout
Posted zeqi1991
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ARX清理layout相关的知识,希望对你有一定的参考价值。
void ClearLayout()
{
CString msLayoutName;
CStringArray layoutNames;
AcDbObjectId msID = acdbSymUtil()->blockModelSpaceId(m_pDatabase);
AcDbObjectId dictId = m_pDatabase->layoutDictionaryId();
AcDbDictionary* pDict = NULL;
if (Acad::eOk == acdbOpenObject(pDict, dictId, AcDb::kForWrite))
{
AcDbDictionaryIterator *iter = pDict->newIterator();
for (; !iter->done(); iter->next())
{
AcDbObject* pDictObj = NULL;
iter->getObject(pDictObj, AcDb::kForWrite);
if (pDictObj->isKindOf(AcDbLayout::desc()))
{
AcDbLayout* pLayout = AcDbLayout::cast(pDictObj);
AcDbObjectId blockTableRecordID = pLayout->getBlockTableRecordId();
TCHAR *name = NULL;
pLayout->getLayoutName(name);
if (blockTableRecordID != msID)//属于模型空间的id
{
layoutNames.Add(name);
}
else
{
msLayoutName = name;
}
}
pDictObj->close();
}
delete iter;
iter = NULL;
pDict->close();
}
//CAD不允许清理所有的布局[除开模型布局以外必须存在一个其他布局],创建一个临时的layout
if (1)
{
AcDbObjectId layoutID, blockRecordID;
acdbHostApplicationServices()->layoutManager()->createLayout(_T("布局"), layoutID, blockRecordID, m_pDatabase);
}
acdbHostApplicationServices()->layoutManager()->setCurrentLayout(msLayoutName, m_pDatabase);
for (int i = 0; i < layoutNames.GetSize(); i++)
{
Acad::ErrorStatus es = acdbHostApplicationServices()->layoutManager()->deleteLayout(layoutNames[i], m_pDatabase);
}
}
以上是关于ARX清理layout的主要内容,如果未能解决你的问题,请参考以下文章
我可以使用 WixBundleDirectoryLayout 或 /layout 示例片段吗?
[Grid Layout] Use auto-fill and auto-fit if the number of repeated grid tracks is not to be def(代码片段