本文整理汇总了C++中AcDbObjectIdArray::length方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbObjectIdArray::length方法的具体用法?C++ AcDbObjectIdArray::length怎么用?C++ AcDbObjectIdArray::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbObjectIdArray
的用法示例。
在下文中一共展示了AcDbObjectIdArray::length方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _extract_vertices_from_lines
void frgExtractTopologicalEntsFromLinesAlgm::_extract_vertices_from_lines(std::vector<Vertex2dsOnSegment2d> &seg_pnts_pairs,
const AcDbObjectIdArray &ids)
{
AcDbEntity *entity = NULL;
acedSetStatusBarProgressMeter(_T("正在提取每根线段上的节点..."), 0, ids.length());
for (int i = 0; i < ids.length(); i++)
{
acdbOpenAcDbEntity(entity, ids[i], AcDb::kForRead);
if (entity == NULL)
continue;
if (entity->isA() != AcDbLine::desc())
{
entity->close();
continue;
}
AcDbLine *line = (AcDbLine *)entity;
Vertex2dsOnSegment2d stru;
stru.seg.set(AcGePoint2d(line->startPoint().x, line->startPoint().y),
AcGePoint2d(line->endPoint().x, line->endPoint().y));
entity->close();
_extract_from_seg(stru);
seg_pnts_pairs.push_back(stru);
acedSetStatusBarProgressMeterPos(i);
}
acedRestoreStatusBar();
}
示例2: ssgetAddFilter
void OnlyOneSelectFilter::ssgetAddFilter (
int ssgetFlags,
AcEdSelectionSetService& service,
const AcDbObjectIdArray& selectionSet,
const AcDbObjectIdArray& subSelectionSet
)
{
//acutPrintf(_T("\n ssgetAddFilter==> select set: %d"), selectionSet.length());
//acutPrintf(_T("\n ssgetAddFilter==> subselect set: %d\n"), subSelectionSet.length());
//AcEdSSGetFilter::ssgetAddFilter (ssgetFlags, service, selectionSet, subSelectionSet) ;
if( selectionSet.length() == 0 )
{
if( subSelectionSet.length() > 1 )
{
int len = subSelectionSet.length();
for( int i = 0; i < len - 1; i++ )
{
Acad::ErrorStatus es = service.remove( i );
}
}
}
else
{
int len = subSelectionSet.length();
for( int i = 0; i < len; i++ )
{
Acad::ErrorStatus es = service.remove( i );
}
}
}
示例3: getAllSymbolRecordsIds
int getAllSymbolRecordsIds(AcRxClass* pTableClass, AcDbObjectIdArray & idaAll)
{
CLogger::Print(_T("*Call: getAllSymbolRecordsIds()"));
Acad::ErrorStatus es;
idaAll.setLogicalLength(0);
AcDbDatabase* pDb = acdbHostApplicationServices()->workingDatabase();
AcDbSymbolTable* pSymbolTable = NULL;
if (AcRx::kEqual == pTableClass->comparedTo(AcDbBlockTable::desc())) {
CLogger::Print(_T("> This is BlockTable!"));
es = pDb->getBlockTable(pSymbolTable, AcDb::kForRead);
}
else if (AcRx::kEqual == pTableClass->comparedTo(AcDbLayerTable::desc())) {
CLogger::Print(_T("> This is LayerTable!"));
es = pDb->getLayerTable(pSymbolTable, AcDb::kForRead);
}
else if (AcRx::kEqual == pTableClass->comparedTo(AcDbLinetypeTable::desc())) {
CLogger::Print(_T("> This is LinetypeTable!"));
es = pDb->getLinetypeTable(pSymbolTable, AcDb::kForRead);
}
else if (AcRx::kEqual == pTableClass->comparedTo(AcDbTextStyleTable::desc())) {
CLogger::Print(_T("> This is TextStyleTable!"));
es = pDb->getTextStyleTable(pSymbolTable, AcDb::kForRead);
}
else {
CLogger::Print(_T("*Exit: getAllSymbolRecordsIds() - This kind of SymbolTable is not supported!"));
return -1;
}
if (Acad::eOk != es) {
CLogger::Print(_T("*Exit: getAllSymbolRecordsIds() - Fail to get SymbolTable!"));
return -1;
}
//------------
// Get the SymbolTable's iterator.
AcDbSymbolTableIterator* pSymbolTableIter = NULL;
es = pSymbolTable->newIterator(pSymbolTableIter);
pSymbolTable->close();
if (Acad::eOk != es) {
CLogger::Print(_T("*Exit: getAllSymbolRecordsIds() - Fail to get the SymbolTable's iterator!"));
return -1;
}
//------------
// Steps through the SymbolTable's records.
// Then get the SymbolTableRecord's ObjectID.
for (; !pSymbolTableIter->done(); pSymbolTableIter->step()) {
AcDbObjectId idObj = AcDbObjectId::kNull;
if (Acad::eOk == pSymbolTableIter->getRecordId(idObj))
idaAll.append(idObj);
}
delete pSymbolTableIter;
CLogger::Print(_T("*Exit: getAllSymbolRecordsIds() - Count: %02d"), idaAll.length());
return idaAll.length();
}
示例4: UpdateAllWindStationData
void DrawCmd::UpdateAllWindStationData()
{
// 查找所有的测风站
// 将所在宿主上的面积、风速、风量数据读取到测风站中
AcDbObjectIdArray objIds;
DrawHelper::FindMineGEs( _T( "WindStation" ), objIds );
if( objIds.isEmpty() ) return;
AcTransaction* pTrans = actrTransactionManager->startTransaction();
if( pTrans == 0 ) return;
AcDbObjectIdArray geObjIds;
int len = objIds.length();
bool ret = true;
for( int i = 0; i < len; i++ )
{
AcDbObject* pObj;
if( Acad::eOk != pTrans->getObject( pObj, objIds[i], AcDb::kForRead ) )
{
ret = false;
break;
}
TagGE* pTag = TagGE::cast( pObj );
if( pTag == 0 )
{
ret = false;
break;
}
geObjIds.append( pTag->getRelatedGE() );
}
actrTransactionManager->endTransaction();
if( !ret )
{
geObjIds.removeAll();
}
else
{
//assert(objIds.length() == geObjIds.length());
int len = objIds.length();
for( int i = 0; i < len; i++ )
{
ReadWriteData( geObjIds[i], _T( "断面面积" ), objIds[i], _T( "测试断面面积" ) );
ReadWriteData( geObjIds[i], _T( "风速" ), objIds[i], _T( "测试风速" ) );
ReadWriteData( geObjIds[i], _T( "风量" ), objIds[i], _T( "测试风量" ) );
}
}
}
示例5: _extract_from_seg
void frgExtractTopologicalEntsFromLinesAlgm::_extract_from_seg(Vertex2dsOnSegment2d &stru)
{
// - 获取相关的线段(相交、重合)
AcDbObjectIdArray ids;
_search_related_segs(ids, stru.seg);
// - 分为两类进行处理:相交和重叠
// -- 增加起点和终点
rlVertex2d *v = NULL;
stru.vertex2ds.insert(std::make_pair(0.0, v));
stru.vertex2ds.insert(std::make_pair(1.0, v));
// -- 处理每一个线段
AcDbEntity *entity = NULL;
for (int i = 0; i < ids.length(); i++)
{
acdbOpenAcDbEntity(entity, ids[i], AcDb::kForRead);
if (entity == NULL)
continue;
if (entity->isA() != AcDbLine::desc())
{
entity->close();
continue;
}
AcDbLine *_line = (AcDbLine *)entity;
AcGeLineSeg2d _seg(AcGePoint2d(_line->startPoint().x, _line->startPoint().y),
AcGePoint2d(_line->endPoint().x, _line->endPoint().y));
_line->close();
_extract_vertices(stru, _seg);
}
}
示例6: YCROYCRO_CG_AddRegion
static void YCROYCRO_CG_AddRegion()
{
ads_name ss;
int rt = acedSSGet(NULL, NULL, NULL, NULL, ss);
AcDbObjectIdArray objIds;
if (rt == RTNORM)
{
long length;
acedSSLength(ss, &length);
for (int i = 0; i < length; i++)
{
ads_name ent;
acedSSName(ss, i, ent);
AcDbObjectId objId;
acdbGetObjectId(objId, ent);
objIds.append(objId);
}
}
acedSSFree(ss);
AcDbObjectIdArray regionIds;
regionIds = CCreateEnt::CreateRegion(objIds);
int number = regionIds.length();
if (number > 0)
{
acutPrintf(_T("\n已经创建%d个面域!"), number);
}
else
{
acutPrintf(_T("\n创建0个面域!"));
}
}
示例7: ConfigDraw
void DrawHelper::ConfigDraw( const CString& geType, const CString& drawName )
{
MineGEDraw* pDraw = MineGEDrawSystem::GetInstance()->getGEDraw( geType, drawName );
if( pDraw == 0 ) return; // 该绘制效果不存在
pDraw->configExtraParams(); // 配置附加参数
AcDbObjectIdArray objIds;
ArxDataTool::GetEntsByType( geType, objIds, false );
if( objIds.isEmpty() ) return; // dwg图形中没有任何geType类型图元
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.at( i ), AcDb::kForWrite ) ) continue;
MineGE* pGE = MineGE::cast( pObj );
if( pGE == 0 ) continue;
pGE->configDraw( pDraw->isA()->name() ); // 更新extra param
pGE->recordGraphicsModified( true ); // 更新图形
}
actrTransactionManager->endTransaction();
AcRxClass* pClass = AcRxClass::cast( acrxClassDictionary->at( geType ) );
if( pClass != 0 && pClass->isDerivedFrom( LinkedGE::desc() ) )
{
UpdateLinkedGE( objIds );
}
}
示例8: SwitchDraw
void DrawHelper::SwitchDraw( const CString& geType, const CString& drawName )
{
// 设置当前可视化效果
if( !SetCurDraw( geType, drawName ) ) return;
// 更新所有指定类型的图元
AcDbObjectIdArray objIds;
ArxDataTool::GetEntsByType( geType, objIds, false );
if( objIds.isEmpty() ) return; // dwg图形中没有任何MineGE类型图元
// 将所有geType类型图元的绘制效果更新
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.at( i ), AcDb::kForWrite ) ) continue;
MineGE* pGE = MineGE::cast( pObj );
if( pGE == 0 ) continue;
pGE->updateDraw(); // 更细可视化效果指针
//pGE->recordGraphicsModified(true); // 更新图形
}
actrTransactionManager->endTransaction();
AcRxClass* pClass = AcRxClass::cast( acrxClassDictionary->at( geType ) );
if( pClass != 0 && pClass->isDerivedFrom( LinkedGE::desc() ) )
{
UpdateLinkedGE( objIds );
}
}
示例9: SelectEntities
bool ArxEntityHelper::SelectEntities( const AcDbObjectIdArray& objIds )
{
//acedSSSetFirst(NULL, NULL);
if( objIds.isEmpty() ) return false;
ads_name ss;
//创建一个空的选择集
if(RTNORM != acedSSAdd( NULL, NULL, ss )) return false;
bool ret = true;
for(int i=0;i<objIds.length();i++)
{
ads_name ename;
if( Acad::eOk != acdbGetAdsName( ename, objIds[i] ) )
{
ret = false;;
break;
}
if( RTNORM != acedSSAdd( ename, ss, ss ) ) // 添加到选择集
{
ret = false;;
break;
}
}
if(ret)
{
acedSSSetFirst( ss, NULL ); // 高亮选中
}
acedSSFree( ss ); // 释放选择集
return ret;
}
示例10:
bool ArxEntityHelper::SetEntitiesColor2( const AcDbObjectIdArray& objIds, const 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::kForWrite ) )
{
actrTransactionManager->abortTransaction();
ret = false;
break;
}
AcDbEntity* pEnt = AcDbEntity::cast( pObj );
if( pEnt == 0 )
{
actrTransactionManager->abortTransaction();
ret = false;
break;
}
pEnt->setColorIndex( colors[i] ); // 恢复原先的颜色
}
actrTransactionManager->endTransaction();
return ret;
}
示例11: SetEntitiesColor
bool ArxEntityHelper::SetEntitiesColor( AcDbObjectIdArray& objIds, unsigned short colorIndex )
{
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::kForWrite ) )
{
actrTransactionManager->abortTransaction();
ret = false;
break;
}
AcDbEntity* pGE = AcDbEntity::cast( pObj );
if( pGE == 0 )
{
actrTransactionManager->abortTransaction();
ret = false;
break;
}
// 设置颜色
pGE->setColorIndex( colorIndex );
}
actrTransactionManager->endTransaction();
return ret;
}
示例12: GetDataObjectFromExtDict
// 从图元的扩展词典中查找数据对象
static void GetDataObjectFromExtDict( AcDbObjectIdArray& dbObjIds )
{
AcDbObjectIdArray allObjIds;
ArxDataTool::GetEntsByType( _T( "MineGE" ), allObjIds, true );
// 判断是否数据对象DataObject
// 且类型名称==type
if( allObjIds.isEmpty() ) return;
AcTransaction* pTrans = actrTransactionManager->startTransaction();
if( pTrans == 0 ) return;
int len = allObjIds.length();
for( int i = 0; i < len; i++ )
{
AcDbObject* pObj;
if( Acad::eOk != pTrans->getObject( pObj, allObjIds[i], AcDb::kForRead ) ) continue;
MineGE* pGE = MineGE::cast( pObj );
if( pGE == 0 ) continue;
AcDbObjectId dbObjId = pGE->getDataObject();
if( !dbObjId.isNull() )
{
dbObjIds.append( dbObjId );
}
}
actrTransactionManager->endTransaction();
}
示例13: 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;
}
示例14: ZoomToEntities
void ArxEntityHelper::ZoomToEntities( const AcDbObjectIdArray& objIds )
{
AcTransaction* pTrans = actrTransactionManager->startTransaction();
if( pTrans == 0 ) return;
AcDbExtents exts;
int len = objIds.length();
for( int i = 0; i < len; i++ )
{
AcDbObject* pObj;
if( Acad::eOk != pTrans->getObject( pObj, objIds[i], AcDb::kForRead ) ) continue;
AcDbEntity* pEnt = AcDbEntity::cast( pObj );
if( pEnt == 0 ) continue;
AcDbExtents extents;
if( Acad::eOk != pEnt->getGeomExtents( extents ) ) continue;
exts.addPoint( extents.minPoint() );
exts.addPoint( extents.maxPoint() );
}
actrTransactionManager->endTransaction();
AcGePoint3d minPt = exts.minPoint();
AcGePoint3d maxPt = exts.maxPoint();
if( minPt.x <= maxPt.x && minPt.y <= maxPt.y && minPt.z <= maxPt.z )
{
ZoomEntity_Helper( minPt, maxPt );
}
}
示例15: UpdateLinkedGE
static void UpdateLinkedGE( const AcDbObjectIdArray& objIds )
{
int len = objIds.length();
for( int i = 0; i < len; i++ )
{
DrawHelper::LinkedGEJunctionClosure2( objIds[i] );
}
}