mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-03-12 14:24:32 +05:00
add parse example
This commit is contained in:
parent
4b4fffa9f5
commit
310b2b8c1b
@ -251,3 +251,55 @@ void BrepGeometryTest::testGetSolidVolume()
|
||||
|
||||
delete geom;
|
||||
}
|
||||
|
||||
void BrepGeometryTest::testParse()
|
||||
{
|
||||
BrepGeometry* geom = new BrepGeometry("box");
|
||||
readBrep(geom, "Box_2.brep");
|
||||
std::cout << std::endl;
|
||||
|
||||
for (int solidIndex = 0; solidIndex < geom->countSolids(); ++solidIndex)
|
||||
{
|
||||
std::cout << "Solid #" << solidIndex << " : " << geom->getSolidReference(solidIndex) << std::endl;
|
||||
int nbShells = geom->countSolidShells(solidIndex);
|
||||
for (int shellIndex = 0; shellIndex < nbShells; ++shellIndex)
|
||||
{
|
||||
std::cout << " Shell #" << shellIndex << std::endl;
|
||||
std::vector<int> faces = geom->getSolidFaces(solidIndex, shellIndex);
|
||||
for (int indf = 0; indf < faces.size(); ++indf)
|
||||
{
|
||||
int faceIndex = faces[indf];
|
||||
std::cout << " Face #" << geom->getFaceReference(faceIndex) << std::endl;
|
||||
|
||||
int nbWires = geom->countFaceWires(faceIndex);
|
||||
for (int wireIndex = 0; wireIndex < nbWires; ++wireIndex)
|
||||
{
|
||||
std::cout << " Wire #" << wireIndex << std::endl;
|
||||
std::vector<int> edges = geom->getFaceEdges(faceIndex, wireIndex);
|
||||
for (int inde = 0; inde < edges.size(); ++inde)
|
||||
{
|
||||
int edgeIndex = edges[inde];
|
||||
std::cout << " Edge #" << geom->getEdgeReference(edgeIndex) << " : ";
|
||||
|
||||
int va = 0, vb = 0;
|
||||
geom->getEdgeVertices(edgeIndex, va, vb);
|
||||
int vaRef = geom->getVertexID(va);
|
||||
int vbRef = geom->getVertexID(vb);
|
||||
double ax, ay, az, bx, by, bz;
|
||||
geom->getVertexXYZ(va, ax, ay, az);
|
||||
geom->getVertexXYZ(vb, bx, by, bz);
|
||||
|
||||
std::cout << vaRef << " (" << ax << ", " << ay << ", " << az << ")";
|
||||
std::cout << " - ";
|
||||
std::cout << vbRef << " (" << bx << ", " << by << ", " << bz << ")";
|
||||
std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete geom;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ namespace XAO
|
||||
CPPUNIT_TEST(testGetEdgeLength);
|
||||
CPPUNIT_TEST(testGetFaceArea);
|
||||
CPPUNIT_TEST(testGetSolidVolume);
|
||||
CPPUNIT_TEST(testParse);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -36,6 +37,8 @@ namespace XAO
|
||||
void testGetEdgeLength();
|
||||
void testGetFaceArea();
|
||||
void testGetSolidVolume();
|
||||
|
||||
void testParse();
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user