本文整理汇总了C++中AcDbObject::extensionDictionary方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbObject::extensionDictionary方法的具体用法?C++ AcDbObject::extensionDictionary怎么用?C++ AcDbObject::extensionDictionary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbObject
的用法示例。
在下文中一共展示了AcDbObject::extensionDictionary方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: GetExtensionDict
AcDbObjectId ArxDictTool::GetExtensionDict( const AcDbObjectId& objId )
{
AcTransaction* pTrans = actrTransactionManager->startTransaction();
if( pTrans == 0 ) return AcDbObjectId::kNull;
AcDbObject* pObj;
if( Acad::eOk != pTrans->getObject( pObj, objId, AcDb::kForWrite ) )
{
actrTransactionManager->abortTransaction();
return AcDbObjectId::kNull;
}
AcDbObjectId dictId = pObj->extensionDictionary();
if( dictId.isNull() )
{
if( Acad::eOk == pObj->createExtensionDictionary() )
{
dictId = pObj->extensionDictionary();
}
}
actrTransactionManager->endTransaction();
return dictId;
}
示例3: 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));
}
示例4: 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
//.........这里部分代码省略.........