Salome HOME
0021308: EDF 1923 SMESH: Remove hard-coded dependency of the external mesh plugins...
[modules/geom.git] / src / GEOM_SWIG / GEOM_TestOthers.py
index 327eea93075511acaa2f0b1177866219b252fbbf..73d91287d3483359cbffd71b065950ad8e772493 100644 (file)
@@ -1,26 +1,25 @@
 #  -*- coding: iso-8859-1 -*-
-#  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 #
-#  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-#  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+# Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 #
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
 #
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Lesser General Public License for more details.
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
 #
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-#  GEOM GEOM_SWIG : binding of C++ implementaion with Python
 #  File   : GEOM_TestOthers.py
 #  Author : Julia DOROVSKIKH
 #  Module : GEOM
@@ -77,7 +76,7 @@ def TestExportImport (geompy, shape):
   geompy.ExportSTEP(shape, fileExportImportSTEP)
 
   # Import
-  Import = geompy.Import(fileExportImport, "BREP")
+  Import = geompy.ImportFile(fileExportImport, "BREP")
 
   id_Import = geompy.addToStudy(Import, "Import")
 
@@ -244,6 +243,11 @@ def TestOtherOperations (geompy, math):
   IsValid = geompy.CheckCompoundOfBlocks(Compound1)
   if IsValid == 0:
     print "The Blocks Compound is NOT VALID"
+    (NonBlocks, NonQuads) = geompy.GetNonBlocks(Compound1)
+    if NonBlocks is not None:
+      geompy.addToStudyInFather(Compound1, NonBlocks, "Group of non-hexahedral solids")
+    if NonQuads is not None:
+      geompy.addToStudyInFather(Compound1, NonQuads, "Group of non-quadrangular faces")
   else:
     print "The Blocks Compound is VALID"
 
@@ -469,7 +473,7 @@ def TestOtherOperations (geompy, math):
   geompy.addToStudy(freeFacesWithoutExtra, "freeFacesWithoutExtra")
 
   # GetSharedShapes
-  sharedFaces = geompy.GetSharedShapes(part, freeFacesWithoutExtra,
+  sharedFaces = geompy.GetSharedShapes(part, freeFaces,
                                        geompy.ShapeType["FACE"])
   ind = 1
   for shFace in sharedFaces:
@@ -477,7 +481,7 @@ def TestOtherOperations (geompy, math):
     ind = ind + 1
     pass
 
-  sharedEdges = geompy.GetSharedShapesMulti([part, freeFacesWithoutExtra],
+  sharedEdges = geompy.GetSharedShapesMulti([part, freeFaces],
                                              geompy.ShapeType["EDGE"])
   ind = 1
   for shEdge in sharedEdges:
@@ -510,6 +514,17 @@ def TestOtherOperations (geompy, math):
   geompy.addToStudyInFather(blocksComp, pb0_top_1, "point from blocksComp (-50,  50,  50)")
   geompy.addToStudyInFather(blocksComp, pb0_bot_1, "point from blocksComp (-50, -50, -50)")
 
+  # GetVertexNearPoint(theShape, thePoint)
+  pb0_top_2_near = geompy.MakeVertex(40, 40, 40)
+  pb0_top_2      = geompy.GetVertexNearPoint(blocksComp, pb0_top_2_near)
+
+  geompy.addToStudyInFather(blocksComp, pb0_top_2, "point from blocksComp near (40,  40,  40)")
+
+  # GetEdge(theShape, thePoint1, thePoint2)
+  edge_top_y50 = geompy.GetEdge(blocksComp, pb0_top_1, pb0_top_2)
+
+  geompy.addToStudyInFather(blocksComp, edge_top_y50, "edge from blocksComp by two points")
+
   # GetEdgeNearPoint(theShape, thePoint)
   pmidle = geompy.MakeVertex(50, 0, 50)
   edge1 = geompy.GetEdgeNearPoint(blocksComp, pmidle)
@@ -521,6 +536,11 @@ def TestOtherOperations (geompy, math):
 
   geompy.addToStudyInFather(blocksComp, b0_image, "b0 image")
 
+  # GetShapesNearPoint(theShape, thePoint, theShapeType, theTolerance)
+  b0_faces_plus = geompy.GetShapesNearPoint(blocksComp, pb0_top_2_near, geompy.ShapeType["FACE"], 0.01)
+
+  geompy.addToStudyInFather(blocksComp, b0_faces_plus, "faces near point (40,  40,  40)")
+
   # GetShapesOnPlane
   faces_on_pln = geompy.GetShapesOnPlane(blocksComp, geompy.ShapeType["FACE"],
                                          v_0pp, geompy.GEOM.ST_ONIN)
@@ -638,10 +658,10 @@ def TestOtherOperations (geompy, math):
   pcyl = geompy.MakeVertex(50, 50, -50)
   cyli = geompy.MakeCylinder(pcyl, vz, 40, 100)
   fuse = geompy.MakeFuse(sph1, cyli)
-  fuse = geompy.MakeFuse(fuse, sph2)
+  sh_1 = geompy.MakeFuse(fuse, sph2)
   # As after Fuse we have a compound, we need to obtain a solid from it
-  shsh = geompy.SubShapeAll(fuse, geompy.ShapeType["SOLID"])
-  sh_1 = shsh[0]
+  #shsh = geompy.SubShapeAll(fuse, geompy.ShapeType["SOLID"])
+  #sh_1 = shsh[0]
   geompy.addToStudy(sh_1, "sh_1")
 
   # GetShapesOnShape