|
- void CRmWindow::solid_meshing(AcDbEntity* entity, const AcGeMatrix3d& trans)
- {
- #if 0
- AcDbSolid* pSolid = AcDbSolid::cast(entity);
- double thickness = pSolid->thickness();
- AcGePoint3d vertices[4];
- int numVertices = 4;
- AcGeVector3d normal = pSolid->normal();
- double elevation = pSolid->elevation();
- for (int i = 0; i < 4; ++i)
- pSolid->getPointAt(i, vertices[i]);
- if (vertices[2].isEqualTo(vertices[3]))
- numVertices = 3;
- for (int i = 0; i < numVertices; ++i)
- vertices[i].z += elevation;
-
- std::vector<AcGePoint3d> allVertices;
- for (int i = 0; i < numVertices; ++i) {
- vertices[i].transformBy(trans);
- allVertices.push_back(vertices[i]);
- }
- for (int i = 0; i < numVertices; ++i) {
- AcGePoint3d extrudedVertex = vertices[i] + normal * thickness;
- extrudedVertex.transformBy(trans);
- allVertices.push_back(extrudedVertex);
- }
- std::ofstream file(path_from_mfc + L'\\' + mesh_file_str, std::ios::app);
- if (!file.is_open()) {
- acutPrintf(L"Failed to open file for writing.\n");
- return;
- }
- std::size_t numTotalVertices = allVertices.size();
- file << global_obj_mesh_counter << '\n' << numTotalVertices << " " << 1 << '\n'; // Number of vertices and one solid
- for (const auto& vertex : allVertices) {
- file << formatDouble(vertex.x) << '\n'
- << formatDouble(vertex.y) << '\n'
- << formatDouble(vertex.z) << '\n';
- }
- file.close();
- #endif
- }
复制代码 |
|