]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
add parse example BR_V7_main_Field
authorfps <fps@opencascade.com>
Thu, 26 Sep 2013 09:22:16 +0000 (09:22 +0000)
committerfps <fps@opencascade.com>
Thu, 26 Sep 2013 09:22:16 +0000 (09:22 +0000)
src/XAO/tests/BrepGeometryTest.cxx
src/XAO/tests/BrepGeometryTest.hxx

index 096676aad85b6a93690ca2f422554f64d78583c8..069b64d31f30155e7c345e71137175311f370863 100644 (file)
@@ -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;
+}
index d74b63ce0ba9be5288211f001c841cf0a4c65590..427c7db8dc947e6e94a6c09e4468ae3647da3fab 100644 (file)
@@ -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();
     };
 }