ObjectARX学习笔记(三十五)----外部参照相关的操作

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
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值