]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Correct test
authorjfa <jfa@opencascade.com>
Tue, 6 Sep 2022 13:06:18 +0000 (16:06 +0300)
committerjfa <jfa@opencascade.com>
Tue, 6 Sep 2022 13:06:18 +0000 (16:06 +0300)
src/GEOM_SWIG/CMakeLists.txt
src/GEOM_SWIG/GEOM_TestCR.py [deleted file]
src/GEOM_SWIG/geomBuilder.py
test/test_CR.py [new file with mode: 0644]
test/tests.set

index 0aae528417189a9ebe3d3d2bec56b87346d44011..39f3ac6af4a860b5bd8b43301e67ffed091a4398 100644 (file)
@@ -59,7 +59,6 @@ SET(_other_SCRIPTS
   GEOM_Nut.py
   GEOM_Sketcher.py
   GEOM_ObjectInfo.py
-  GEOM_TestCR.py
   PAL_MESH_019_020_geometry.py
   PAL_MESH_028_geometry.py
   PAL_MESH_030_geometry.py
diff --git a/src/GEOM_SWIG/GEOM_TestCR.py b/src/GEOM_SWIG/GEOM_TestCR.py
deleted file mode 100644 (file)
index 1bf0b2a..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-#  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2022  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
-#
-# 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, or (at your option) any later version.
-#
-# 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
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-import salome
-
-salome.salome_init()
-
-import GEOM
-from salome.geom import geomBuilder
-import math
-import SALOMEDS
-
-geompy = geomBuilder.New()
-
-def GetShapeType(theShape):
-    CR = geompy.CanonicalRecognition()
-    if CR.isLine(theShape, 0.1)[0]:
-        return "Line"
-    if CR.isPlane(theShape, 0.1)[0]:
-        if CR.isCircle(theShape, 0.1)[0]:
-            return ("Plane","Circle")
-        if CR.isEllipse(theShape, 0.1)[0]:
-            return ("Plane","Ellipse")
-        return "Plane"
-    if CR.isSphere(theShape, 0.1)[0]:
-        return "Sphere"
-    if CR.isCone(theShape, 0.1)[0]:
-        return "Cone"
-    if CR.isCylinder(theShape, 0.1)[0]:
-        return "Cylinder"
-    return "Not defined"
-
-O = geompy.MakeVertex(0, 0, 0)
-OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
-OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
-OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
-Cylinder_1 = geompy.MakeCylinderRH(100, 300)
-[Face_1,Face_2,Face_3] = geompy.ExtractShapes(Cylinder_1, geompy.ShapeType["FACE"], True)
-[Edge_1,Edge_2,Edge_3] = geompy.ExtractShapes(Cylinder_1, geompy.ShapeType["EDGE"], True)
-Sphere_1 = geompy.MakeSphereR(100)
-[Shell_1] = geompy.ExtractShapes(Sphere_1, geompy.ShapeType["SHELL"], True)
-Cone_1 = geompy.MakeConeR1R2H(100, 0, 300)
-[Shell_2] = geompy.ExtractShapes(Cone_1, geompy.ShapeType["SHELL"], True)
-[Face_4,Face_5] = geompy.ExtractShapes(Shell_2, geompy.ShapeType["FACE"], True)
-
-## Create ellips
-Cylinder_2 = geompy.MakeCylinderRH(100, 300)
-Plane_1 = geompy.MakePlaneLCS(None, 350, 1)
-Translation_1 = geompy.MakeTranslation(Plane_1, 0, 0, 150)
-Rotation_1 = geompy.MakeRotation(Translation_1, OX, 20*math.pi/180.0)
-Partition_1 = geompy.MakePartition([Cylinder_2], [Rotation_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
-[Edge_4,Edge_5,Edge_6,Edge_7,Edge_8] = geompy.ExtractShapes(Partition_1, geompy.ShapeType["EDGE"], True)
-
-assert GetShapeType(Face_1) == "Plane"
-assert GetShapeType(Face_2) == "Cylinder"
-assert GetShapeType(Edge_3) == "Line"
-assert GetShapeType(Edge_2)[1] == "Circle"
-assert GetShapeType(Shell_1) == "Sphere"
-assert GetShapeType(Shell_2) == "Cone"
-assert GetShapeType(Edge_5)[1] == "Ellipse"
index 827a257e71670deb8f39ce7115235e4441dbac66..5d6a516a2a7a971d33a55d352cc677f7405c05eb 100644 (file)
@@ -2787,21 +2787,6 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             pl = Polyline2D (self)
             return pl
 
-        ## Obtain a 2D polyline creation interface
-        #  @return An instance of @ref gsketcher.Polyline2D "Polyline2D" interface
-        #
-        #  @ref tui_3dsketcher_page "Example"
-        def CanonicalRecognition (self):
-            """
-            Obtain a canonical recognition interface.
-
-            Example of usage:
-                cr = geompy.CanonicalRecognition()
-                cr.isLine(aLine, tolerance)
-            """
-            cr = CanonicalRecognition (self)
-            return cr
-
         # end of l3_sketcher
         ## @}
 
@@ -11771,6 +11756,22 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             aDescr = self.MeasuOp.IsGoodForSolid(theShell)
             return aDescr
 
+        ## Obtain a canonical recognition interface.
+        #  @return An instance of
+        #          @ref canonicalrecognition.CanonicalRecognition "CanonicalRecognition" interface
+        #
+        #  @ref tui_3dsketcher_page "Example"
+        def CanonicalRecognition (self):
+            """
+            Obtain a canonical recognition interface.
+
+            Example of usage:
+                cr = geompy.CanonicalRecognition()
+                cr.isLine(aLine, tolerance)
+            """
+            cr = CanonicalRecognition (self)
+            return cr
+
         # end of l2_measure
         ## @}
 
diff --git a/test/test_CR.py b/test/test_CR.py
new file mode 100644 (file)
index 0000000..1bf0b2a
--- /dev/null
@@ -0,0 +1,80 @@
+#  -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2022  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
+#
+# 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, or (at your option) any later version.
+#
+# 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
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import salome
+
+salome.salome_init()
+
+import GEOM
+from salome.geom import geomBuilder
+import math
+import SALOMEDS
+
+geompy = geomBuilder.New()
+
+def GetShapeType(theShape):
+    CR = geompy.CanonicalRecognition()
+    if CR.isLine(theShape, 0.1)[0]:
+        return "Line"
+    if CR.isPlane(theShape, 0.1)[0]:
+        if CR.isCircle(theShape, 0.1)[0]:
+            return ("Plane","Circle")
+        if CR.isEllipse(theShape, 0.1)[0]:
+            return ("Plane","Ellipse")
+        return "Plane"
+    if CR.isSphere(theShape, 0.1)[0]:
+        return "Sphere"
+    if CR.isCone(theShape, 0.1)[0]:
+        return "Cone"
+    if CR.isCylinder(theShape, 0.1)[0]:
+        return "Cylinder"
+    return "Not defined"
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Cylinder_1 = geompy.MakeCylinderRH(100, 300)
+[Face_1,Face_2,Face_3] = geompy.ExtractShapes(Cylinder_1, geompy.ShapeType["FACE"], True)
+[Edge_1,Edge_2,Edge_3] = geompy.ExtractShapes(Cylinder_1, geompy.ShapeType["EDGE"], True)
+Sphere_1 = geompy.MakeSphereR(100)
+[Shell_1] = geompy.ExtractShapes(Sphere_1, geompy.ShapeType["SHELL"], True)
+Cone_1 = geompy.MakeConeR1R2H(100, 0, 300)
+[Shell_2] = geompy.ExtractShapes(Cone_1, geompy.ShapeType["SHELL"], True)
+[Face_4,Face_5] = geompy.ExtractShapes(Shell_2, geompy.ShapeType["FACE"], True)
+
+## Create ellips
+Cylinder_2 = geompy.MakeCylinderRH(100, 300)
+Plane_1 = geompy.MakePlaneLCS(None, 350, 1)
+Translation_1 = geompy.MakeTranslation(Plane_1, 0, 0, 150)
+Rotation_1 = geompy.MakeRotation(Translation_1, OX, 20*math.pi/180.0)
+Partition_1 = geompy.MakePartition([Cylinder_2], [Rotation_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
+[Edge_4,Edge_5,Edge_6,Edge_7,Edge_8] = geompy.ExtractShapes(Partition_1, geompy.ShapeType["EDGE"], True)
+
+assert GetShapeType(Face_1) == "Plane"
+assert GetShapeType(Face_2) == "Cylinder"
+assert GetShapeType(Edge_3) == "Line"
+assert GetShapeType(Edge_2)[1] == "Circle"
+assert GetShapeType(Shell_1) == "Sphere"
+assert GetShapeType(Shell_2) == "Cone"
+assert GetShapeType(Edge_5)[1] == "Ellipse"
index f9d399eff7b8463debe319b894cda999dfe10ff2..8b5c4e5a6b99e71a498b75cdacf27c498e817185 100644 (file)
@@ -19,4 +19,5 @@
 
 SET(ALL_TESTS
   test_perf_01.py
+  test_CR.py
   )