本文整理汇总了C++中AcDbEntity::colorIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbEntity::colorIndex方法的具体用法?C++ AcDbEntity::colorIndex怎么用?C++ AcDbEntity::colorIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbEntity
的用法示例。
在下文中一共展示了AcDbEntity::colorIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetEntitiesColor
bool ArxEntityHelper::GetEntitiesColor( const AcDbObjectIdArray& objIds, AcArray<Adesk::UInt16>& colors )
{
AcTransaction* pTrans = actrTransactionManager->startTransaction();
if( pTrans == 0 ) return false;
bool ret = true; // 默认返回true
int len = objIds.length();
for( int i = 0; i < len; i++ )
{
AcDbObject* pObj;
if( Acad::eOk != pTrans->getObject( pObj, objIds[i], AcDb::kForRead ) )
{
actrTransactionManager->abortTransaction();
ret = false;
colors.removeAll(); // 清空
break;
}
AcDbEntity* pEnt = AcDbEntity::cast( pObj );
if( pEnt == 0 )
{
actrTransactionManager->abortTransaction();
ret = false;
colors.removeAll(); // 清空
break;
}
Adesk::UInt16 ci = pEnt->colorIndex();
colors.append( ci ); // 记录原有的颜色
}
actrTransactionManager->endTransaction();
return ret;
}
示例2: GetEntityColor
bool ArxEntityHelper::GetEntityColor( const AcDbObjectId& objId, Adesk::UInt16& colorIndex )
{
AcTransaction* pTrans = actrTransactionManager->startTransaction();
if( pTrans == 0 ) return false;
AcDbObject* pObj;
if( Acad::eOk != pTrans->getObject( pObj, objId, AcDb::kForRead ) )
{
actrTransactionManager->abortTransaction();
return false;
}
AcDbEntity* pEnt = AcDbEntity::cast( pObj );
if( pEnt == 0 )
{
actrTransactionManager->abortTransaction();
return false;
}
colorIndex = pEnt->colorIndex();
actrTransactionManager->endTransaction();
return true;
}