外部参照相关的操作
Acad::ErrorStatus acdbResolveCurrentXRefs(AcDbDatabase* pHostDb,bool useThreadEngine = true, bool doNewOnly = false);
/* acdbAttachXref --
This function is used to attach a new xref to the specified file
(pFilename) to a given database (pDb)..
A new block table record with the name specified by pBlockName
will be created and resolved as an external reference.
The id of the new record will be set into xrefBlkId.
*/
Acad::ErrorStatus acdbAttachXref(AcDbDatabase* pHostDb,
const ACHAR * pFilename,
const ACHAR * pBlockName,
AcDbObjectId& xrefBlkId);
/* acdbOverlayhXref --
This function is used to overlay a new xref to the specified file
(pFilename) to a given database (pDb)..
A new block table record with the name specified by pBlockName
will be created and resolved as an external reference and flagged
as an overlay.The id of the new record will be set into xrefBlkId.
*/
Acad::ErrorStatus acdbOverlayXref(AcDbDatabase* pHostDb,
const ACHAR * pFilename,
const ACHAR * pBlockName,
AcDbObjectId& xrefBlkId);
/* acdbDetachXref --
This function is used to detach a specified xref (xrefBlkId) from the
given database (pDb). Note, references to the xref should be
erased prior to using this function.
*/
Acad::ErrorStatus acdbDetachXref(AcDbDatabase* pHostDb,
const AcDbObjectId& xrefBlkId);
Acad::ErrorStatus acdbUnloadXrefs(AcDbDatabase* pHostDb,
const AcDbObjectIdArray& xrefBlkIds,
const bool bQuiet = true);
Acad::ErrorStatus acdbReloadXrefs(AcDbDatabase* pHostDb,
const AcDbObjectIdArray& xrefBlkIds,
bool bQuiet = true);
Acad::ErrorStatus acdbBindXrefs(AcDbDatabase* pHostDb,
const AcDbObjectIdArray& xrefBlkIds,
const bool bInsertBind,
const bool bAllowUnresolved = false,
const bool bQuiet = true);
Acad::ErrorStatus acdbXBindXrefs(AcDbDatabase* pHostDb,
const AcDbObjectIdArray xrefSymbolIds,
const bool bInsertBind,
const bool bQuiet = true);
//以下是使用例子
AcDbDatabase*pDb = acdbCurDwg();
if (pDb == NULL)
{
return;
}
AcApDocument * pDoc = acDocManager->curDocument();
if (pDoc == NULL)
return ;
//锁定文档很重要 否则会执行失败
acDocManager->lockDocument(pDoc);
Acad::ErrorStatus es;
es = acdbBindXrefs(pDb,m_entIdArry,true);//插入当前dwg
/*其他的绑定附加 拆离 卸载 类似 把函数换掉既可*/
if (es == Acad::eOk)
{
acutPrintf(_T("\n绑定外部参照成功!\n"));
}
m_StrXrefArray.RemoveAll();
actrTransactionManager->flushGraphics();
acedUpdateDisplay();
acDocManager->unlockDocument(pDoc);
页:
[1]