本文整理汇总了C++中AcDbEntity::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbEntity::erase方法的具体用法?C++ AcDbEntity::erase怎么用?C++ AcDbEntity::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbEntity
的用法示例。
在下文中一共展示了AcDbEntity::erase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FilterDb
//0,不显示属性,1,显示属性,2,显示属性默认值
void CZhfPalette::FilterDb(AcDbDatabase* pDb, int iFilterMode)
{
if (iFilterMode==1)
{
return ;
}
Acad::ErrorStatus es ;
AcDbBlockTable* pBT = NULL ;
pDb->getBlockTable(pBT, AcDb::kForRead);
AcDbBlockTableRecord* pBTR = NULL;
es = pBT->getAt(ACDB_MODEL_SPACE, pBTR, AcDb::kForWrite);
pBT->close();
AcDbBlockTableRecordIterator* pIT;
es = pBTR->newIterator(pIT) ;
for (; !pIT->done(); pIT->step())
{
AcDbEntity* pEnt = NULL ;
if (Acad::eOk==pIT->getEntity(pEnt, AcDb::kForWrite))
{
if (pEnt->isKindOf(AcDbAttributeDefinition::desc()))
{
AcDbAttributeDefinition *pAttDef = AcDbAttributeDefinition::cast(pEnt);
if (iFilterMode==0)
{
pEnt->erase() ;
}
else if (iFilterMode>1)
{
if (pAttDef != NULL && !pAttDef->isConstant())
{
// We have a non-constant attribute definition,
// so build an attribute entity.
CString strShowVal ;
if (iFilterMode==2)
{
strShowVal = pAttDef->textString() ;
}
else if (iFilterMode==3)
{
strShowVal = pAttDef->prompt() ; //显示中文为乱码
}
pAttDef->setTag(strShowVal) ;
}
}
}
pEnt->close() ;
}
}
delete pIT;
pBTR->close();
}
示例2:
Acad::ErrorStatus
ArxDbgUtils::defineNewBlock(LPCTSTR blkName, AcDbBlockTableRecord*& newBlkRec,
AcDbObjectId& newBlkRecId, AcDbDatabase* db)
{
ASSERT(db != NULL);
AcDbBlockTable* blkTbl;
Acad::ErrorStatus es = db->getSymbolTable(blkTbl, AcDb::kForWrite);
if (es != Acad::eOk)
return es;
// if this block already exists, erase its contents first
if (blkTbl->getAt(blkName, newBlkRec, AcDb::kForWrite) == Acad::eOk) {
newBlkRecId = newBlkRec->objectId();
AcDbBlockTableRecordIterator* iter;
es = newBlkRec->newIterator(iter);
if (es != Acad::eOk) {
ArxDbgUtils::rxErrorMsg(es);
newBlkRec->close();
}
else {
AcDbEntity* ent;
for (; !iter->done(); iter->step()) {
if (iter->getEntity(ent, AcDb::kForWrite) == Acad::eOk) {
ent->erase();
ent->close();
}
}
delete iter;
}
}
else { // create a new block table record and add it to the block table
newBlkRec = new AcDbBlockTableRecord;
newBlkRec->setPathName(AcadString::nullStr); // constructor doesn't do it properly
es = newBlkRec->setName(blkName);
if (es == Acad::eOk)
es = blkTbl->add(newBlkRecId, newBlkRec);
if (es != Acad::eOk) {
ArxDbgUtils::rxErrorMsg(es);
delete newBlkRec;
}
}
blkTbl->close(); // doesn't need to be open anymore
return es;
}