本文整理汇总了C++中AcDbDictionary::getAt方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbDictionary::getAt方法的具体用法?C++ AcDbDictionary::getAt怎么用?C++ AcDbDictionary::getAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbDictionary
的用法示例。
在下文中一共展示了AcDbDictionary::getAt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getAppDictionary
AcDbObjectId OarxEmployeeService::getAppDictionary () {
AcDbDictionary *pNOD =NULL ;
AcDbDictionary *pFirmDict =NULL ;
AcDbDictionary *pAppDict =NULL ;
try {
//----- Get hold of the NOD
ARXOK ( getNOD (pNOD, AcDb::kForRead) ) ;
//----- Get our Firm Dictionary
AcDbObjectId id0 ;
if ( pNOD->getAt (OARX_FIRM_DICT, id0) == Acad::eKeyNotFound ) {
//----- Then create it
pFirmDict =new AcDbDictionary ;
if ( pFirmDict == NULL )
throw Acad::eOutOfMemory ;
ARXOK ( pNOD->upgradeOpen () ) ;
ARXOK ( pNOD->setAt (OARX_FIRM_DICT, pFirmDict, id0) ) ;
} else {
//----- Open the dictionary
ARXOK ( acdbOpenAcDbObject ((AcDbObject *&)pFirmDict, id0, AcDb::kForRead) ) ;
}
//----- Get our App Dictionary
if ( pFirmDict->getAt (OARX_APP_DICT, id0) == Acad::eKeyNotFound ) {
//----- Then create it
pAppDict =new AcDbDictionary ;
if ( pAppDict == NULL )
throw Acad::eOutOfMemory ;
if ( pFirmDict->isWriteEnabled () == false )
ARXOK ( pFirmDict->upgradeOpen () ) ;
ARXOK ( pFirmDict->setAt (OARX_APP_DICT, pAppDict, id0) ) ;
id0 =pAppDict->objectId () ;
}
pNOD->close () ;
pFirmDict->close () ;
pAppDict->close () ;
return (id0) ;
} catch (const Acad::ErrorStatus es) {
if ( pNOD != NULL )
pNOD->cancel () ;
if ( pFirmDict != NULL && pFirmDict->objectId () == AcDbObjectId::kNull )
delete pFirmDict ;
else if ( pFirmDict != NULL )
pFirmDict->cancel () ;
if ( pAppDict != NULL && pAppDict->objectId () == AcDbObjectId::kNull )
delete pAppDict ;
else
pAppDict->cancel () ;
return (AcDbObjectId::kNull) ;
}
}
示例2: RegDict
void ArxDictTool::RegDict( const CString& dictName )
{
// 初始化工作,建立存储词典
AcDbDictionary* pNamedobj;
acdbHostApplicationServices()->workingDatabase()->getNamedObjectsDictionary( pNamedobj, AcDb::kForWrite );
AcDbObject* pObj;
Acad::ErrorStatus es = pNamedobj->getAt( dictName, pObj, AcDb::kForRead );
if( Acad::eOk == es )
{
pObj->close();
}
else if( Acad::eKeyNotFound == es )
{
AcDbDictionary* pDict = new AcDbDictionary();
AcDbObjectId dictId;
if( Acad::eOk != pNamedobj->setAt( dictName, pDict, dictId ) )
{
delete pDict;
}
else
{
pDict->close();
}
}
pNamedobj->close();
}
示例3: CreateSubDictionaryID
Acad::ErrorStatus CTwArxDictionary::CreateSubDictionaryID( IN const AcDbObjectId& IdRoot, IN const CString& strKey, OUT AcDbObjectId& IdSubDic, IN AcRxClass* pRxObjType /*= AcDbDictionary::desc() */ ) const
{
if( pRxObjType == NULL ) return Acad::eNullObjectPointer;
Acad::ErrorStatus es = Acad::eOk;
AcDbDictionary* pDicRoot = NULL;
AcDbDatabase* pWdb = acdbCurDwg();
if( IdRoot.isNull() )
es = pWdb->getNamedObjectsDictionary( pDicRoot, AcDb::kForRead );
else
es = acdbOpenObject( pDicRoot, IdRoot, AcDb::kForRead );
if( es != Acad::eOk ) return es;
if( pDicRoot->has(strKey) )
{
pDicRoot->getAt( strKey, IdSubDic );
pDicRoot->close();
return es;
}
pDicRoot->upgradeOpen();
AcDbObject* pObj = (AcDbObject*)pRxObjType->create();
es = pDicRoot->setAt( strKey, pObj, IdSubDic );
pObj->close();
pDicRoot->close();
return es;
}
示例4: 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());
}
示例5: GetXRecordManager
static ArxXRecordManager* GetXRecordManager( const AcDbObjectId& dictId, const CString& key, bool createNewKey = false )
{
//acutPrintf(_T("\n注册: %s"), dictName);
AcDbDictionary* pDict = GetDictObject( dictId );
if( pDict == 0 ) return 0;
AcDbXrecord* pXrec = 0;
// key不存在或者其它原因
Acad::ErrorStatus es = pDict->getAt( key, ( AcDbObject*& ) pXrec, AcDb::kForWrite );
if( Acad::eOk != es && Acad::eKeyNotFound != es )
{
pDict->close();
return 0;
}
if( Acad::eKeyNotFound == es )
{
if( createNewKey )
{
pXrec = new AcDbXrecord();
AcDbObjectId xrecObjId;
pDict->setAt( key, pXrec, xrecObjId );
}
else
{
pDict->close();
return 0;
}
}
pDict->close();
return new ArxXRecordManager( pXrec );
}
示例6: selectObject
// The listxrecord() functions gets the xrecord associated with the
// key "ASDK_XREC1" and lists out its contents by passing the resbuf
// list to the function printList().
//
void
listXrecord()
{
AcDbObject *pObj;
AcDbXrecord *pXrec;
AcDbObjectId dictObjId;
AcDbDictionary *pDict;
pObj = selectObject(AcDb::kForRead);
if (pObj == NULL) {
return;
}
// Get the object ID of the object's extension dictionary.
//
dictObjId = pObj->extensionDictionary();
pObj->close();
// Open the extension dictionary and get the xrecord
// associated with the key ASDK_XREC1.
//
acdbOpenObject(pDict, dictObjId, AcDb::kForRead);
pDict->getAt("ASDK_XREC1", (AcDbObject*&)pXrec,
AcDb::kForRead);
pDict->close();
// Get the xrecord's data list and then close the xrecord.
//
struct resbuf *pRbList;
pXrec->rbChain(&pRbList);
pXrec->close();
printList(pRbList);
acutRelRb(pRbList);
}
示例7: acdbHostApplicationServices
// The list tree function runs through all objects in the ASDK_DICT dictionary,
// follows their ownership trees, and lists out information
// on all objects in the tree.
//
void
listTree()
{
AcDbDictionary *pNamedobj;
AcDbDictionary *pDict;
acdbHostApplicationServices()->workingDatabase()
->getNamedObjectsDictionary(pNamedobj, AcDb::kForWrite);
// Get a pointer to the ASDK_DICT dictionary.
//
if (pNamedobj->getAt(_T("ASDK_DICT"), (AcDbObject*&) pDict,
AcDb::kForRead) == Acad::eKeyNotFound)
{
pNamedobj->close();
return ;
}
pNamedobj->close();
// Run through the entries and list their backpointers.
//
AcDbDictionaryIterator *pDictItr = pDict->newIterator();
for (; !pDictItr->done(); pDictItr->next()) {
printOut(pDictItr->objectId());
}
delete pDictItr;
pDict->close();
}
示例8: acutPrintf
//-------------------------------------------------------------------------------------------
//
// 功能: 将从AcDbObject派生数据库对象保存到实体的扩展词典中
//
// 作者:Qin H.X.
//
// 日期:200709
//
// 历史:
// 2007.10.08 修改 by Qin H.X.
//
//----------------------------------------------------------------------------------------------
// - CSCH081.AddAttribute command (do not rename)
static void CSCH081AddAttribute(void)
{
AcDbObjectId dictObjId,eId, attId;
AcDbDictionary* pDict;
//选择管道(多义线)
ads_name en;
ads_point pt;
if ( acedEntSel(_T("\n选择管道(多义线): "), en, pt)!= RTNORM)
{
acutPrintf(_T("\n选择失败,退出: "));
return ;
}
// 打开对象
acdbGetObjectId(eId, en);
AcDbEntity * pEnt;
acdbOpenObject(pEnt, eId, AcDb::kForWrite);
if(!pEnt->isKindOf (AcDbPolyline::desc ()))
{
acutPrintf(_T("\n选择的不是管道(多义线),退出: " ));
return ;
}
// 判断实体的扩展词典是否创建,如果没有则创建
dictObjId = pEnt->extensionDictionary();
if( dictObjId == AcDbObjectId::kNull )
{
pEnt->createExtensionDictionary();
}
// 获取实体的扩展词典
dictObjId = pEnt->extensionDictionary();
pEnt->close();
// 判断词典中的属性是否创建
CPipeAttribute* pAttribute;
acdbOpenObject(pDict, dictObjId, AcDb::kForWrite);
pDict->getAt (_T("属性"),attId);
if(attId!= AcDbObjectId::kNull )//如果已经创建则输出数据
{
acdbOpenObject(pAttribute, attId, AcDb::kForRead);
acutPrintf(_T("\n管径:%4.2f " ),pAttribute->m_dRadius);
acutPrintf(_T("\n壁厚:%4.2f " ),pAttribute->m_dThickness );
acutPrintf(_T("\n埋深:%4.2f " ),pAttribute->m_dDeep );
acutPrintf(_T("\n材质:%s " ),pAttribute->m_cMaterial );
}
else
{
//没有则创建属性
pAttribute = new CPipeAttribute();
pDict->setAt(_T("属性"), pAttribute, attId);
}
//关闭对象
pDict->close();
pAttribute->close();
}
示例9: GetDictObject
bool ArxDictTool2::findEntry( const CString& key, AcDbObjectId& objId )
{
AcDbDictionary* pDict = GetDictObject( m_dictId );
if( pDict == 0 ) return false;
bool ret = ( Acad::eOk == pDict->getAt( key, objId ) );
//acutPrintf(_T("\nArxDitToll->Ret:%s"),ret?_T("Y"):_T("N"));
pDict->close();
return ret;
}
示例10: isEmployeeExist
//-----------------------------------------------------------------------------
//----- This is the AcRxService class Implementation
Adesk::Boolean OarxEmployeeService::isEmployeeExist (int id) {
AcDbDictionary *pNOD =NULL ;
AcDbDictionary *pFirmDict =NULL ;
AcDbDictionary *pAppDict =NULL ;
try {
//----- Get hold of the NOD
ARXOK ( getNOD (pNOD, AcDb::kForRead) ) ;
//----- Get our Firm Dictionary
AcDbObjectId id0 ;
ARXOK ( pNOD->getAt (OARX_FIRM_DICT, id0) ) ;
ARXOK ( acdbOpenAcDbObject ((AcDbObject *&)pFirmDict, id0, AcDb::kForRead) ) ;
//----- Get our App Dictionary
ARXOK ( pFirmDict->getAt (OARX_APP_DICT, id0) ) ;
ARXOK ( acdbOpenAcDbObject ((AcDbObject *&)pAppDict, id0, AcDb::kForRead) ) ;
//----- Check if that entry already exist
char buffer [33] ;
sprintf (buffer, "%d", id) ;
Adesk::Boolean bRet =pAppDict->has (buffer) ;
//----- Normally we should have open the associated XRecord, and check the validity of
//----- the SoftPointerId which is supposed to point to an OarxEmployee entity... But
//----- to simplify the sample we stop checking here!
pNOD->close () ;
pFirmDict->close () ;
pAppDict->close () ;
return (bRet) ;
} catch (const Acad::ErrorStatus es) {
if ( pNOD != NULL )
pNOD->cancel () ;
if ( pFirmDict != NULL )
pFirmDict->cancel () ;
if ( pAppDict != NULL )
pAppDict->cancel () ;
return (Adesk::kFalse) ;
}
}
示例11: GetDict
AcDbObjectId ArxDictTool::GetDict( const CString& dictName )
{
AcDbDictionary* pNameObjDict;
if( Acad::eOk != acdbHostApplicationServices()->workingDatabase()->getNamedObjectsDictionary( pNameObjDict, AcDb::kForRead ) )
{
return AcDbObjectId::kNull;
}
AcDbObjectId dictId;
Acad::ErrorStatus es = pNameObjDict->getAt( dictName, dictId );
pNameObjDict->close();
return dictId;
}
示例12:
AcDbObjectId
ArxDbgUiTdcPersistentReactors::getPersistentEntReactor(AcDbDatabase* db, bool createIfNotFound)
{
static LPCTSTR dictEntryName = _T("ARXDBG_PERSISTENT_ENT_REACTOR");
AcDbObjectId prId;
AcDbDictionary* prDict;
// first see if its already there without "disturbing" anyone by opening them
// for write.
prDict = ArxDbgUtils::openDictionaryForRead(m_dictName, db);
if (prDict != NULL) {
if (prDict->getAt(dictEntryName, prId) == Acad::eOk) {
prDict->close();
return prId;
}
prDict->close();
}
// couldn't find it, bail if we aren't supposed to create it.
if (createIfNotFound == false)
return AcDbObjectId::kNull;
// not here yet, so make an entry
prDict = ArxDbgUtils::openDictionaryForWrite(m_dictName, true, db);
if (prDict == NULL)
return AcDbObjectId::kNull;
Acad::ErrorStatus es;
ArxDbgPersistentEntReactor* pr = new ArxDbgPersistentEntReactor;
es = prDict->setAt(dictEntryName, pr, prId);
if (es != Acad::eOk) {
ArxDbgUtils::rxErrorMsg(es);
ArxDbgUtils::alertBox(_T("ERROR: Could not add entry to dictionary."));
delete pr;
prDict->close();
return AcDbObjectId::kNull;
}
else {
pr->close();
prDict->close();
return prId;
}
}
示例13: GetSubDictionaryID
Acad::ErrorStatus CTwArxDictionary::GetSubDictionaryID( IN const AcDbObjectId& IdRoot, IN const CString& strKey, AcDbObjectId& IdSub, AcDbDatabase* pCurDB ) const
{
Acad::ErrorStatus es = Acad::eOk;
AcDbDictionary* pDicRoot = NULL;
AcDbDatabase* pWdb = pCurDB;
if( pWdb == NULL )
pWdb = acdbCurDwg();
if( IdRoot.isNull() )
es = pWdb->getNamedObjectsDictionary( pDicRoot, AcDb::kForRead );
else
es = acdbOpenObject( pDicRoot, IdRoot, AcDb::kForRead );
if( pDicRoot == NULL ) return es;
pDicRoot->close();
es = pDicRoot->getAt( strKey, IdSub );
return es;
}
示例14: acdbGetReservedString
AcDbObjectId
ArxDbgDbAdeskLogoStyle::getStandardStyle(AcDbDatabase* db, bool makeIfNotThere)
{
Acad::ErrorStatus es;
AcDbObjectId styleId;
AcDbDictionary* dict;
const char* standardStrPtr = acdbGetReservedString(AcDb::kStandard, false);
ASSERT(standardStrPtr != NULL);
dict = ArxDbgUtils::openDictionaryForRead(m_dictName, db);
if (dict) {
es = dict->getAt(standardStrPtr, styleId);
dict->close();
if (es == Acad::eOk)
return styleId;
if (makeIfNotThere == false)
return AcDbObjectId::kNull;
}
// wasn't already there, so we need to make it
dict = ArxDbgUtils::openDictionaryForWrite(m_dictName, true, db);
if (dict) {
ArxDbgDbAdeskLogoStyle* newRec = new ArxDbgDbAdeskLogoStyle;
es = dict->setAt(standardStrPtr, newRec, styleId);
dict->close();
if (es == Acad::eOk) {
newRec->close();
return styleId;
}
else {
acutPrintf("\nERROR: Could not add new ArxDbgDbAdeskLogoStyle (%s)", ArxDbgUtils::rxErrorStr(es));
delete newRec;
}
}
return AcDbObjectId::kNull;
}
示例15: listEmpsCommand
void listEmpsCommand()
{
//this cannot really happen but...
if (acdbHostApplicationServices()->workingDatabase()==NULL)
return;
AcDbDictionaryIterator* pIter=NULL;
try
{
//start transaction for the db operations in this command
actrTransactionManager->startTransaction();
//get the named object dictionary
AcDbDictionary* pNOD;
ARXOK(getNOD(pNOD,AcDb::kForRead));
//see if our dictionary is there
AcDbObjectId idO;
ARXOK(pNOD->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;
if ((pIter = pEmployeeDict->newIterator(AcRx::kDictCollated))!=NULL){
for (;!pIter->done();pIter->next()){
//get the object
ARXOK(actrTransactionManager->getObject(pO,pIter->objectId(),AcDb::kForRead));
//check if it is the right one
EmployeeEntry* pEmployeeEntry;
if ((pEmployeeEntry=EmployeeEntry::cast(pO))==NULL)
throw Acad::eNotThatKindOfClass;
//get the corresponding EmployeeDetail object
ARXOK(actrTransactionManager->getObject(pO,pEmployeeEntry->employee(),AcDb::kForRead));
EmployeeDetails* pEmployeeDetails;
if ((pEmployeeDetails=EmployeeDetails::cast(pO))==NULL)
throw Acad::eNotThatKindOfClass;
//print the details now
acutPrintf("*Employee's ID:%d\n",pEmployeeDetails->ID());
acutPrintf("*Employee's cube number:%d\n",pEmployeeDetails->cubeNumber());
acutPrintf("*Employee's first name:%s\n",pEmployeeDetails->firstName());
acutPrintf("*Employee's last name:%s\n",pEmployeeDetails->lastName());
//this will ease memory burden when implemented
ARXOK(actrTransactionManager->markObjectPageable(pO));
}
//shouldn't forget this
delete pIter;
pIter=NULL;
}
actrTransactionManager->endTransaction();
}
catch (const Acad::ErrorStatus es)
{
if (pIter!=NULL)
delete pIter;
//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));
}
}