本文整理汇总了C++中AcDbEntity::extensionDictionary方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbEntity::extensionDictionary方法的具体用法?C++ AcDbEntity::extensionDictionary怎么用?C++ AcDbEntity::extensionDictionary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbEntity
的用法示例。
在下文中一共展示了AcDbEntity::extensionDictionary方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: Wblock
Acad::ErrorStatus CZhfPalette::Wblock(AcDbDatabase*& pDbFrom, AcDbDatabase*& pDbTo, /*const AcGePoint3d& pt_3d_base,*/ const AcGeMatrix3d & xform)
{
Acad::ErrorStatus es ;
AcDbObjectIdArray objIdsOut;
AcDbBlockTable* pBT = NULL ;
pDbFrom->getBlockTable(pBT, AcDb::kForRead);
AcDbBlockTableRecord* pBTR = NULL;
es = pBT->getAt(ACDB_MODEL_SPACE, pBTR, AcDb::kForRead);
pBT->close();
AcDbBlockTableRecordIterator* pIT;
es = pBTR->newIterator(pIT) ;
for (; !pIT->done(); pIT->step())
{
AcDbEntity* pEnt = NULL ;
if (Acad::eOk==pIT->getEntity(pEnt, AcDb::kForRead))
{
// if (!pEnt->isKindOf(AcDbAttributeDefinition::desc()))
// {
AcDbObjectId objId;
if (Acad::eOk == pIT->getEntityId(objId))
{
objIdsOut.append(objId);
}
// }
pEnt->close() ;
}
}
delete pIT;
pBTR->close();
if (!objIdsOut.isEmpty())
{
for (int i=0; i<objIdsOut.length(); i++)
{
AcDbObjectId objId = objIdsOut.at(i);
AcDbEntity *pEnt = NULL ;
if(Acad::eOk==acdbOpenAcDbEntity(pEnt,objId, AcDb::kForRead))
{
AcDbObjectId objIdDic ;
if ((objIdDic = pEnt->extensionDictionary())!= AcDbObjectId::kNull)
{
AcDbDictionary *pDict = NULL;
if (Acad::eOk==acdbOpenObject(pDict, objIdDic, AcDb::kForWrite))
{
pDict->setTreatElementsAsHard(Adesk::kTrue);
pDict->close();
}
}
pEnt->close() ;
}
}
AcDbDatabase *pTempDb ;
es = pDbFrom->wblock( pTempDb, objIdsOut, AcGePoint3d::kOrigin ) ;
if (Acad::eOk != es )
{
acedAlert( _T("wblock failed!") );
return es ;
}
es = pDbTo->insert( xform, pTempDb ) ;
if (Acad::eOk != es)
acedAlert( _T("insert failed!" ));
if (pTempDb)
{
delete pTempDb;
pTempDb = NULL ;
}
}
else
{
acutPrintf(_T("\nNo entities found in model space of DWG"));
}
return es ;
}