本文整理汇总了C++中AcDbObject::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbObject::erase方法的具体用法?C++ AcDbObject::erase怎么用?C++ AcDbObject::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbObject
的用法示例。
在下文中一共展示了AcDbObject::erase方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mapIter
void
ArxDbgAppEditorReactor::verifyClonedReferences(AcDbIdMapping& idMap)
{
ArxDbgDbEntity* ent;
AcDbObject* obj;
Acad::ErrorStatus es;
int numErrorsFixed;
AcDbIdPair idPair;
AcDbIdMappingIter mapIter(idMap);
for (mapIter.start(); !mapIter.done(); mapIter.next()) {
if (mapIter.getMap(idPair)) {
es = acdbOpenObject(obj, idPair.value(), AcDb::kForWrite);
if (es == Acad::eOk) {
ent = ArxDbgDbEntity::cast(obj);
if (ent != NULL) {
es = ent->verifyReferences(numErrorsFixed, true);
if (es != Acad::eOk) {
ASSERT(0);
ArxDbgUtils::rxErrorMsg(es);
obj->erase(); // don't know what else to do but erase screwed up entity
}
}
obj->close();
}
else {
ASSERT(0);
ArxDbgUtils::rxErrorMsg(es);
}
}
else {
ASSERT(0);
}
}
}
示例2: ARXOK
void
removeEntryFromDict(const char* strDictKey, AcDbDictionary* pParent,
const char* strEmpKey)
{
AcDbObjectId idO;
//see if our dictionary is there
ARXOK(pParent->getAt(strDictKey,idO));
//get it for write
AcDbObject* pO;
ARXOK(actrTransactionManager->getObject(pO,idO,AcDb::kForWrite));
//check if someone has else has created an entry with our name
//that is not a dictionary. This should never happen as long as
//I use the registered developer ID.
AcDbDictionary* pEmployeeDict;
if ((pEmployeeDict=AcDbDictionary::cast(pO))==NULL)
throw Acad::eNotThatKindOfClass;
//check if a record with this key isthere
ARXOK(pEmployeeDict->getAt(strEmpKey,idO));
//get it for write
ARXOK(actrTransactionManager->getObject(pO,idO,AcDb::kForWrite));
//and erase it
ARXOK(pO->erase());
//erase dictionary if it has no more entries
if (pParent->numEntries()==0)
ARXOK(pParent->erase());
}
示例3:
void ArxEntityHelper::EraseObject2( const AcDbObjectId& objId, Adesk::Boolean erasing )
{
AcDbObject* pObj;
if( Acad::eOk == acdbOpenAcDbObject( pObj, objId, AcDb::kForWrite, !erasing ) )
{
pObj->erase( erasing );
pObj->close();
//acutPrintf(_T("\n使用Open/close机制删除对象成功"));
}
}
示例4: EraseObject
void ArxEntityHelper::EraseObject( const AcDbObjectId& objId, Adesk::Boolean erasing )
{
AcTransaction* pTrans = actrTransactionManager->startTransaction();
if( pTrans == 0 ) return;
AcDbObject* pObj;
if( Acad::eOk == pTrans->getObject( pObj, objId, AcDb::kForWrite, !erasing ) )
{
pObj->erase( erasing ); // (反)删除图元
}
actrTransactionManager->endTransaction();
}
示例5: EraseObjects
void ArxEntityHelper::EraseObjects( const AcDbObjectIdArray& objIds, Adesk::Boolean erasing )
{
if( objIds.isEmpty() ) return;
AcTransaction* pTrans = actrTransactionManager->startTransaction();
if( pTrans == 0 ) return;
int len = objIds.length();
for( int i = 0; i < len; i++ )
{
AcDbObject* pObj;
if( Acad::eOk != pTrans->getObject( pObj, objIds[i], AcDb::kForWrite, !erasing ) ) continue;
pObj->erase( erasing ); // (反)删除图元
}
actrTransactionManager->endTransaction();
}
示例6: removeEmpCommand
void removeEmpCommand()
{
//this cannot really happen but...
if (acdbHostApplicationServices()->workingDatabase()==NULL)
return;
try
{
//start transaction for the db operations in this command
actrTransactionManager->startTransaction();
//get you extension dictionary
AcDbDictionary* pExtDict = NULL;
getExtDictOfObject(pExtDict);
//get the id from the EmployeeDetails object
//see if our dictionary is there
AcDbObjectId idO;
ARXOK(pExtDict->getAt(DICT,idO));
//get it for write
AcDbObject* pO;
ARXOK(actrTransactionManager->getObject(pO,idO,AcDb::kForWrite));
//check if someone has else has created an entry with our name
//that is not a dictionary. This should never happen as long as
//I use the registered developer ID.
AcDbDictionary* pEmployeeDict=NULL;
if ((pEmployeeDict=AcDbDictionary::cast(pO))==NULL)
throw Acad::eNotThatKindOfClass;
//check if a record with this key is there
ARXOK(pEmployeeDict->getAt(DETAILS,idO));
//get it for write
ARXOK(actrTransactionManager->getObject(pO,idO,AcDb::kForWrite));
EmployeeDetails* pEmployeeDetails;
if ((pEmployeeDetails=EmployeeDetails::cast(pO))==NULL)
throw Acad::eNotThatKindOfClass;
//create string key from the employee id
char strID[33];
sprintf(strID,"%d",pEmployeeDetails->ID());
//and then erase it
ARXOK(pO->erase());
//get hold of the NOD
AcDbDictionary* pNOD;
ARXOK(getNOD(pNOD,AcDb::kForWrite));
//remove the EmployeeEntry from NOD
removeEntryFromDict(DICT,pNOD,strID);
actrTransactionManager->endTransaction();
}
catch (const Acad::ErrorStatus es)
{
//abort, rollback all db operations
actrTransactionManager->abortTransaction();
//check if the user has cancelled us, then we don't report
//anything
if (es!=Acad::eUserBreak)
acutPrintf("***Error: %s\n",acadErrorStatusText(es));
}
}