admin 发表于 2024-3-14 20:45:16

每日一码] ARX使用ActiveX 接口查找所有的XREF


#include "stdafx.h"
#include "acad.h" // generated by MFC ClassWizard

// no error checking for code brevity
void printXrefBtrs()
{
    IAcadApplication iApp(acedGetAcadWinApp()->GetIDispatch(TRUE));
    IAcadDocument iDoc(iApp.GetActiveDocument());
    IAcadBlocks iBlks(iDoc.GetBlocks());
    for(long i=0; i<iBlks.GetCount(); i++)
    {
      采用variant采用t x(i);
      IAcadBlock iBlk(iBlks.Item(x));
      if(iBlk.GetIsXRef() == TRUE)
      {
            CString str = iBlk.GetName();
            acutPrintf("\nBTR # %d is a Xref with name: %s", i,
str);
      }
    }
}
页: [1]
查看完整版本: 每日一码] ARX使用ActiveX 接口查找所有的XREF