本文整理汇总了C++中AcDbObject::isKindOf方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbObject::isKindOf方法的具体用法?C++ AcDbObject::isKindOf怎么用?C++ AcDbObject::isKindOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbObject
的用法示例。
在下文中一共展示了AcDbObject::isKindOf方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
ArxDbgAppEditorReactor::searchOneDictionary(AcDbDictionary* dict, AcDbObjectIdArray& objIds)
{
// get an iterator over this dictionary
AcDbDictionaryIterator* dictIter = dict->newIterator();
ASSERT(dictIter != NULL);
// walk dictionary and just collect all the entries that are of the
// given type
AcDbObject* obj;
for (; !dictIter->done(); dictIter->next()) {
if (acdbOpenAcDbObject(obj, dictIter->objectId(), AcDb::kForRead) == Acad::eOk) {
if (obj->isKindOf(ArxDbgDbDictRecord::desc())) {
objIds.append(obj->objectId());
}
else if (obj->isKindOf(AcDbDictionary::desc())) {
searchOneDictionary(AcDbDictionary::cast(obj), objIds);
}
obj->close();
}
}
delete dictIter;
dict->close();
}
示例2: acedEntSel
// This is the main function of this app. It allows the
// user to select an entity. It then checks to see if the
// entity is a 2d-polyline. If so, then it calls iterate
// passing in the objectId of the pline.
//
void
listPline()
{
int rc;
ads_name en;
AcGePoint3d pt;
rc = acedEntSel(_T("\nSelect a polyline: "), en,
asDblArray(pt));
if (rc != RTNORM) {
acutPrintf(_T("\nError during object selection"));
return;
}
AcDbObjectId eId;
acdbGetObjectId(eId, en);
AcDbObject *pObj;
acdbOpenObject(pObj, eId, AcDb::kForRead);
if (pObj->isKindOf(AcDb2dPolyline::desc())) {
pObj->close();
iterate(eId);
} else {
pObj->close();
acutPrintf(_T("\nSelected entity is not an AcDb2dPolyline. \nMake sure the setvar PLINETYPE is set to 0 before createing a polyline"));
}
}
示例3: acdbOpenAcDbObject
void
ArxDbgUiTdcWblockClone::divideCloneSet(const AcDbObjectIdArray& cloneSet,
AcDbObjectIdArray& nonEntSet,
AcDbObjectIdArray& okToCloneSet)
{
Acad::ErrorStatus es;
AcDbObject* obj;
int len = cloneSet.length();
for (int i=0; i<len; i++) {
es = acdbOpenAcDbObject(obj, cloneSet[i], AcDb::kForRead);
if (es == Acad::eOk) {
if (obj->isKindOf(AcDbEntity::desc()))
okToCloneSet.append(obj->objectId());
else
nonEntSet.append(obj->objectId());
obj->close();
}
}
}
示例4:
static void GetTagGEById2_Helper( const CString& geType, const AcDbObjectIdArray& allObjIds, AcDbObjectIdArray& objIds )
{
AcRxClass* pClass = AcRxClass::cast( acrxClassDictionary->at( geType ) );
if( pClass == 0 ) return;
AcTransaction* pTrans = actrTransactionManager->startTransaction();
if( pTrans == 0 ) return;
int len = allObjIds.length();
for( int i = 0; i < len; i++ )
{
AcDbObject* pObj;
if( Acad::eOk != pTrans->getObject( pObj, allObjIds[i], AcDb::kForRead ) ) continue;
if( pObj->isKindOf( pClass ) )
{
objIds.append( allObjIds[i] );
}
}
actrTransactionManager->endTransaction();
}
示例5: GetDataObjectFromDict
// 获取词典下的所有
static void GetDataObjectFromDict( const CString& dictName, AcDbObjectIdArray& dbObjIds )
{
AcDbObjectIdArray allObjIds;
ArxDictTool2* pDict = ArxDictTool2::GetDictTool( dictName );
pDict->getAllEntries( allObjIds );
delete pDict;
AcTransaction* pTrans = actrTransactionManager->startTransaction();
if( pTrans == 0 ) return;
int len = allObjIds.length();
for( int i = 0; i < len; i++ )
{
AcDbObject* pObj;
if( Acad::eOk != pTrans->getObject( pObj, allObjIds[i], AcDb::kForRead ) ) continue;
if( pObj->isKindOf( DataObject::desc() ) )
{
dbObjIds.append( allObjIds[i] );
}
}
actrTransactionManager->endTransaction();
}
示例6: ADSOK
void
getExtDictOfObject(AcDbDictionary*& pExtDict)
{
ads_name ename;
ads_point pt;
ADSOK(acedEntSel("Select employee:",ename,pt));
//do a quick check
//a more comprehensive check could include
//whether we already have the detail object on this candidate
AcDbObjectId idO;
ARXOK(acdbGetObjectId(idO,ename));
AcDbObject* pO;
ARXOK(actrTransactionManager->getObject(pO,idO,AcDb::kForRead));
if (!pO->isKindOf(AcDbBlockReference::desc()))
throw Acad::eNotThatKindOfClass;
if ((idO = pO->extensionDictionary())==AcDbObjectId::kNull)
throw Acad::eKeyNotFound;
//make sure that you open erased extension dictionaries
ARXOK(actrTransactionManager->getObject((AcDbObject*&)pExtDict,idO,AcDb::kForWrite, Adesk::kTrue));
if (pExtDict->isErased())
ARXOK(pExtDict->erase(Adesk::kFalse));
}
示例7: addEmpCommand
void addEmpCommand()
{
AcDbDictionary* pEmployeeDict=NULL;
EmployeeDetails* pEmployeeDetails=NULL;
EmployeeEntry* pEmployeeEntry=NULL;
//this cannot really happen but...
if (acdbHostApplicationServices()->workingDatabase()==NULL)
return;
try
{
//start transaction for the db operations in this command
actrTransactionManager->startTransaction();
//get the data from the user
ads_name ename;
ads_point pt;
ADSOK(acedEntSel("Select employee:",ename,pt));
//do a quick check
//a more comprehensive check could include
//a check to see if we already have the detail object on this candidate
AcDbObjectId idO;
ARXOK(acdbGetObjectId(idO,ename));
AcDbObject* pO;
ARXOK(actrTransactionManager->getObject(pO,idO,AcDb::kForWrite));
if (!pO->isKindOf(AcDbBlockReference::desc()))
throw Acad::eNotThatKindOfClass;
//go on getting user input
int id;
ADSOK(acedGetInt("Enter employee ID:",&id));
int cubeNumber;
ADSOK(acedGetInt("Enter cube number:",&cubeNumber));
char strFirstName[133];
ADSOK(acedGetString(0,"Enter employee first name:",strFirstName));
char strLastName[133];
ADSOK(acedGetString(0,"Enter employee last name:",strLastName));
//create an EmployeeDetails object and set its fields
if ((pEmployeeDetails= new EmployeeDetails)==NULL)
throw Acad::eOutOfMemory;
ARXOK(pEmployeeDetails->setID(id));
ARXOK(pEmployeeDetails->setCubeNumber(cubeNumber));
ARXOK(pEmployeeDetails->setFirstName(strFirstName));
ARXOK(pEmployeeDetails->setLastName(strLastName));
//get hold of the extension dictionary
if ((idO = pO->extensionDictionary())==AcDbObjectId::kNull){
ARXOK(pO->createExtensionDictionary());
idO = pO->extensionDictionary();
}
AcDbDictionary* pExtDict;
//make sure you open erased extension dictionaries
//you may need to unerase them
ARXOK(actrTransactionManager->getObject((AcDbObject*&)pExtDict,idO,AcDb::kForWrite,Adesk::kTrue));
//add the EmployeeDetails to the extension dictionary
addDictAndEntry(DICT,pExtDict,DETAILS,pEmployeeDetails);
//create the EmployeeEntry and set the id it holds to
//point to the corresponding EmployeeDetails
if ((pEmployeeEntry= new EmployeeEntry)==NULL)
throw Acad::eOutOfMemory;
ARXOK(pEmployeeEntry->setEmployee(pEmployeeDetails->objectId()));
//get hold of the NOD
AcDbDictionary* pNOD;
ARXOK(getNOD(pNOD,AcDb::kForWrite));
//create string key from the employee id
char strID[33];
sprintf(strID,"%d",id);
//set the EmployeeEntry to the NOD
addDictAndEntry(DICT,pNOD,strID,pEmployeeEntry);
actrTransactionManager->endTransaction();
}
catch (const Acad::ErrorStatus es)
{
//we have run into some error
//do the proper cleanup. a smart pointer could check these in its
//destructor and then we wouldn't need this but we I don't want to
//complicate the picture with that yet.
if (pEmployeeDict!=NULL &&
pEmployeeDict->objectId()==AcDbObjectId::kNull)
delete pEmployeeDict;
if (pEmployeeDetails!=NULL &&
pEmployeeDetails->objectId()==AcDbObjectId::kNull)
delete pEmployeeDetails;
if (pEmployeeEntry!=NULL &&
pEmployeeEntry->objectId()==AcDbObjectId::kNull)
delete pEmployeeEntry;
//abort, rollback all db operations
actrTransactionManager->abortTransaction();
//check if the user has cancelled us, then we don't report
//anything
//.........这里部分代码省略.........