|
- void DeleteBlockReference(AcDbEntity* pEnt)
- {
- if (pEnt->isA() == AcDbBlockReference::desc())
- {
- AcDbBlockReference* pBlkRef = AcDbBlockReference::cast(pEnt);
- if (pBlkRef != nullptr)
- {
- // 删除块参照前也可以选择获取并处理其属性或其他信息
- // ...
- Acad::ErrorStatus es = pBlkRef->erase();
- if (es == Acad::eOk)
- {
- pBlkRef->close();
- }
- }
- }
- }
- // 示例在选定集上删除所有块参照
- AcDbVoidPtrArray entities;
- ads采用name ss;
- acedSSGet(NULL, NULL, NULL, NULL, ss);
- Acad::ErrorStatus es = acdbGsMarker(ss, entities);
- if (es == Acad::eOk)
- {
- for (int i = 0; i < entities.length(); ++i)
- {
- AcDbEntity* pEnt;
- es = acdbOpenObject(pEnt, (AcDbObjectId)entities[i], AcDb::kForWrite);
- if (es == Acad::eOk)
- {
- DeleteBlockReference(pEnt);
- pEnt->close();
- }
- }
- }
- acdbClear采用ss(ss);
复制代码 |
|