Salome HOME
Merge remote-tracking branch 'remotes/origin/Dev_FolderFeature'
[modules/shaper.git] / test.API / SHAPER / Transformations / TestAPI_Symmetry.py
index 409d39863a7298a5256ad1574dbe57b30dca130e..0e0110fa38641a6285472cc0db77c519668fcdeb 100644 (file)
@@ -1,48 +1,72 @@
-# Copyright (C) 2014-2016 CEA/DEN, EDF R&D
-
-# File:        TestAPI_Symmetry.py
-# Created:     15 Nov 2016
-# Author:      Clarisse Genrault (CEA)
+## Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+##
+## 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<mailto:webmaster.salome@opencascade.com>
+##
 
 from GeomAlgoAPI import GeomAlgoAPI_ShapeAPI as shaperpy
 from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept
-from GeomAPI import GeomAPI_Ax1 as axis
-from GeomAPI import GeomAPI_Ax2 as plane
 from GeomAPI import GeomAPI_Pnt as pnt
 from GeomAPI import GeomAPI_Dir as direction
+from GeomAPI import GeomAPI_Ax1 as axis
+from GeomAPI import GeomAPI_Ax2 as plane
 
-# Create a box
-try :
-  box1 = shaperpy.makeBox(10.,10.,10.)
-  box2 = shaperpy.makeBox(10.,10.,10.)
-  box3 = shaperpy.makeBox(10.,10.,10.)
-except myExcept, ec:
-  print ec.what()
-
-# Perfom a symmetry by a point.
-try :
-  origin = pnt(0.,0.,0.)
-  symmetry1 = shaperpy.makeSymmetry(box1,origin)
-except myExcept, ec:
-  print ec.what()
+# Create boxes
+Box_1 = shaperpy.makeBox(10., 10., 10.)
+Box_2 = shaperpy.makeBox(10., 10., 10.)
+Box_3 = shaperpy.makeBox(10., 10., 10.)
+Box_4 = shaperpy.makeBox(10., 10., 10.)
+Box_5 = shaperpy.makeBox(10., 10., 10.)
+Box_6 = shaperpy.makeBox(10., 10., 10.)
+Box_7 = shaperpy.makeBox(10., 10., 10.)
+Box_8 = shaperpy.makeBox(10., 10., 10.)
+Box_9 = shaperpy.makeBox(10., 10., 10.)
+Box_10 = shaperpy.makeBox(10., 10., 10.)
+Box_11 = shaperpy.makeBox(10., 10., 10.)
+Box_12 = shaperpy.makeBox(10., 10., 10.)
+Box_13 = shaperpy.makeBox(10., 10., 10.)
+Box_14 = shaperpy.makeBox(10., 10., 10.)
+Box_15 = shaperpy.makeBox(10., 10., 10.)
+Box_16 = shaperpy.makeBox(10., 10., 10.)
+Box_17 = shaperpy.makeBox(10., 10., 10.)
+Box_18 = shaperpy.makeBox(10., 10., 10.)
+
+# Create points
+origin = pnt(0., 0., 0.)
+pnt1 = pnt(-10., -10., -10)
+
+# Create Axis
+dirZ = direction(0., 0., 10.)
+axZ = axis(origin, dirZ)
+
+dir1 = direction(10., 10., 10.)
+ax1 = axis(origin, dir1)
+
+# Create Planes
+planeXOY = plane(origin, dirZ)
+
+Symmetry_1 = shaperpy.makeSymmetry(Box_1, origin)
+Symmetry_2 = shaperpy.makeSymmetry(Box_2, pnt1)
 
-# Perfom a symmetry by an axis.
-try :
-  xDir = direction(1.,0.,0.)
-  xAxis = axis(origin, xDir)
-  translation2 = shaperpy.makeSymmetry(box2,xAxis)
-except myExcept, ec:
-  print ec.what()
-
-# Perfom a symmetry by a plane.
 try :
-  pnt1 = pnt(0.,0.,10.)
-  pnt2 = pnt(10.,0.,10.)
-  aPlane = plane(origin, xDir)
-  translation3 = shaperpy.makeSymmetry(box3,aPlane)
-except myExcept, ec:
-  print ec.what()
+    Symmetry_6 = shaperpy.makeSymmetry(Box_2, None)
+except myExcept,ec :
+    assert(ec.what() == "Symmetry builder :: point is not valid.")
+
+Symmetry_7 = shaperpy.makeSymmetry(Box_7, axZ)
+Symmetry_8 = shaperpy.makeSymmetry(Box_8, ax1)
+Symmetry_13 = shaperpy.makeSymmetry(Box_13, planeXOY)