void countSubents() { AcBr::ErrorStatus returnValue = AcBr::eOk; Acad::ErrorStatus acadReturnValue = eOk; // Get the subentity path for a brep AcDbFullSubentPath subPath(kNullSubent); acadReturnValue = selectEntity(AcDb::kNullSubentType, subPath); if (acadReturnValue != eOk) { acutPrintf(ACRX_T("\n Error in getPath: %d"), acadReturnValue); return; } // Make a brep entity to access the solid AcBrBrep brepEntity; returnValue = ((AcBrEntity*)&brepEntity)->set(subPath); if (returnValue != AcBr::eOk) { acutPrintf(ACRX_T("\n Error in AcBrBrep::set:")); errorReport(returnValue); return; } // count the unique complexes in the brep returnValue = countComplexes(brepEntity); if (returnValue != AcBr::eOk) { acutPrintf(ACRX_T("\n Error in countComplexes:")); errorReport(returnValue); return; } // count the unique shells in the brep returnValue = countShells(brepEntity); if (returnValue != AcBr::eOk) { acutPrintf(ACRX_T("\n Error in countShells:")); errorReport(returnValue); return; } // count the unique faces in the brep returnValue = countFaces(brepEntity); if (returnValue != AcBr::eOk) { acutPrintf(ACRX_T("\n Error in countFaces:")); errorReport(returnValue); return; } // count the unique edges in the brep returnValue = countEdges(brepEntity); if (returnValue != AcBr::eOk) { acutPrintf(ACRX_T("\n Error in countEdges:")); errorReport(returnValue); return; } // count the unique vertices in the brep returnValue = countVertices(brepEntity); if (returnValue != AcBr::eOk) { acutPrintf(ACRX_T("\n Error in countVertices:")); errorReport(returnValue); return; } return; }
/*! * Extract the edge network from surface mesh. If adjacencies are not built * edges shared by more than 1 element are counted twice. Edges are appended * to the content of the input SurfUnstructured * * \param[in,out] net on output stores the network of edges */ void SurfUnstructured::extractEdgeNetwork(SurfUnstructured &net) { // ====================================================================== // // VARIABLES DECLARATION // // ====================================================================== // // Local variables bool check; int n_faces, n_adj, n_vert; long id; vector<int> face_loc_connect; vector<long> face_connect; // Counters int i, j; vector<int>::const_iterator i_; vector<long>::iterator j_; VertexIterator v_, ve_ = vertexEnd(); CellIterator c_, ce_ = cellEnd(); // ====================================================================== // // INITIALIZE DATA STRUCTURE // // ====================================================================== // net.reserveCells(net.getCellCount() + countFaces()); net.reserveVertices(net.getVertexCount() + getVertexCount()); // ====================================================================== // // ADD VERTEX TO net // // ====================================================================== // for (v_ = vertexBegin(); v_ != ve_; ++v_) { net.addVertex(v_->getCoords(), v_->getId()); } //next v_ // ====================================================================== // // ADD EDGES // // ====================================================================== // for (c_ = cellBegin(); c_ != ce_; ++c_) { id = c_->getId(); n_faces = c_->getFaceCount(); for (i = 0; i < n_faces; ++i) { check = true; n_adj = c_->getAdjacencyCount(i); for (j = 0; j < n_adj; ++j) { check = check && (id > c_->getAdjacency(i, j)); } //next j if (check) { face_loc_connect = c_->getFaceLocalConnect(i); n_vert = face_loc_connect.size(); face_connect.resize(n_vert); j_ = face_connect.begin(); for (i_ = face_loc_connect.cbegin(); i_ != face_loc_connect.cend(); ++i_) { *j_ = c_->getVertex(*i_); ++j_; } //next i_ net.addCell(c_->getFaceType(i), true, face_connect); } } //next i } //next c_ return; }