1 # Copyright (C) 2014-2020 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #=========================================================================
24 # Initialization of the test
25 #=========================================================================
30 from salome.shaper import model
32 __updated__ = "2020-11-12"
34 #=========================================================================
35 # test get point coordinates
36 #=========================================================================
37 def test_point_coordinates():
40 file_path = os.path.join(os.getenv("DATA_DIR"),"Shapes","Brep","box1.brep")
41 partSet = model.moduleDocument()
42 Part_1 = model.addPart(partSet)
43 Part_1_doc = Part_1.document()
44 Import_1 = model.addImport(Part_1_doc,file_path)
48 coordinates = model.getPointCoordinates(Part_1_doc,model.selection("VERTEX", "[box1_1/Shape_2][box1_1/Shape_3][box1_1/Shape_6]"))
50 print(" x: ", coordinates[0])
51 print(" y: ", coordinates[1])
52 print(" z: ", coordinates[2])
56 assert (math.fabs(aRes - aRef) < myDelta), "The coordinate X is wrong: expected = {0}, real = {1}".format(aRef, aRes)
60 assert (math.fabs(aRes - aRef) < myDelta), "The coordinate Y is wrong: expected = {0}, real = {1}".format(aRef, aRes)
64 assert (math.fabs(aRes - aRef) < myDelta), "The coordinate Z is wrong: expected = {0}, real = {1}".format(aRef, aRes)
67 if __name__ == '__main__':
69 test_point_coordinates()
71 #=========================================================================
73 #=========================================================================