本文整理汇总了C++中AcDbDatabase::getNamedObjectsDictionary方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbDatabase::getNamedObjectsDictionary方法的具体用法?C++ AcDbDatabase::getNamedObjectsDictionary怎么用?C++ AcDbDatabase::getNamedObjectsDictionary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbDatabase
的用法示例。
在下文中一共展示了AcDbDatabase::getNamedObjectsDictionary方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: acdbHostApplicationServices
void
createObjs()
{
AcDbObjectId objIdA, objIdB, objIdC;
AcDbDictionary *pNamedobj;
AcDbDictionary *pDict = NULL;
AcDbDatabase *pCurDwg = acdbHostApplicationServices()->workingDatabase();
// Create object C with a dummy integer data value of 3.
//
AsdkOwnerDemo *pObjC = new AsdkOwnerDemo(3);
// Append object C to database without setting an owner.
//
pCurDwg->addAcDbObject(objIdC, pObjC);
pObjC->close();
// Create object B with a dummy integer data value of 2.
//
AsdkOwnerDemo *pObjB = new AsdkOwnerDemo(2);
// Append object B to the database without setting an owner.
//
pCurDwg->addAcDbObject(objIdB, pObjB);
// Now set up ownership for object C. The
// AsdkOwnerDemo::setIdData() function takes the
// objectId parameter and copies it into the
// AcDbHardOwnershipId data member. This places the
// object ID in a position to be filed out/in via the
// dwgInFields/dwgOutFields/dxfInFields/dxfOutFields
// member functions. This constitutes primary
// "ownership." The AsdkOwnerDemo::setIdData() function
// also calls each owned object's setOwnerId() member
// function to set the backpointer and establish the
// full two-way ownership link.
//
pObjB->setIdData(objIdC);
pObjB->close();
// Create object A with a dummy integer data value of 1.
//
AsdkOwnerDemo *pObjA = new AsdkOwnerDemo(1);
// Next, add objA to a dictionary in the named object
// dictionary. This will establish ownership for objA,
// set the ownership backlink, and add it to the
// database.
//
pCurDwg->getNamedObjectsDictionary(pNamedobj,
AcDb::kForWrite);
// Get a pointer to the ASDK_DICT dictionary. If it
// doesn't exist, then create it and add it to the
// named object dictionary.
//
if (pNamedobj->getAt("ASDK_DICT", (AcDbObject*&) pDict,
AcDb::kForWrite) == Acad::eKeyNotFound)
{
pDict = new AcDbDictionary;
AcDbObjectId DictId;
pNamedobj->setAt("ASDK_DICT", pDict, DictId);
}
pNamedobj->close();
// add object A to the ASDK_DICT dictionary
//
pDict->setAt("OBJA", pObjA, objIdA);
pDict->close();
// Now set up ownership for object B.
//
pObjA->setIdData(objIdB);
pObjA->close();
}