示例#1
0
void ArxEntityHelper::ShowEntities( const AcDbObjectIdArray& objIds, bool isVisible )
{
    AcTransaction* pTrans = actrTransactionManager->startTransaction();
    if( pTrans == 0 ) return;

    int len = objIds.length();
    for( int i = 0; i < len; i++ )
    {
        AcDbObject* pObj;
        if( Acad::eOk != pTrans->getObject( pObj, objIds[i], AcDb::kForWrite ) ) continue;;

        AcDbEntity* pEnt = AcDbEntity::cast( pObj );
        if( pEnt == 0 ) continue;

        pEnt->setVisibility( isVisible ? AcDb::kVisible : AcDb::kInvisible ); // 显示或隐藏图元(修改)
    }

    actrTransactionManager->endTransaction();
}
示例#2
0
void ArxEntityHelper::ShowEntity( const AcDbObjectId& objId, bool isVisible )
{
    AcTransaction* pTrans = actrTransactionManager->startTransaction();
    if( pTrans == 0 ) return;

    AcDbObject* pObj;
    if( Acad::eOk != pTrans->getObject( pObj, objId, AcDb::kForWrite ) )
    {
        actrTransactionManager->abortTransaction();
        return;
    }

    AcDbEntity* pEnt = AcDbEntity::cast( pObj );
    if( pEnt == 0 )
    {
        actrTransactionManager->abortTransaction();
        return;
    }

    pEnt->setVisibility( isVisible ? AcDb::kVisible : AcDb::kInvisible ); // 显示或隐藏图元(修改)

    actrTransactionManager->endTransaction();
}