1 # Copyright (C) 2021-2023 CEA, EDF
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
21 from salome.shaper import model
27 data_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")
31 partSet = model.moduleDocument()
34 Part_1 = model.addPart(partSet)
35 Part_1_doc = Part_1.document()
38 Import_1 = model.addImport(Part_1_doc, os.path.join(data_dir, "cube_ascii.stl"))
40 Import_1.setName("cube_ascii")
41 Import_1.result().setName("cube_ascii")
42 BoundingBox_1 = model.getBoundingBox(Part_1_doc, model.selection("SOLID", "cube_ascii"))
44 Import_2 = model.addImport(Part_1_doc, os.path.join(data_dir, "cube_binary.stl"))
46 Import_2.setName("cube_binary")
47 Import_2.result().setName("cube_binary")
51 #=============================================================================
53 #=============================================================================
55 model.checkResult(Import_1, model, 1, [0], [1], [12], [36], [72])
56 r=Import_1.defaultResult()
64 assert(abs(dx-14) <= tol)
65 assert(abs(dy-8) <= tol)
66 assert(abs(dz-5) <= tol)
67 model.testResultsVolumes(Import_1, [560.0000222], theNbSignificantDigits = 7)
70 model.checkResult(Import_2, model, 1, [0], [1], [12], [36], [72])
71 r=Import_2.defaultResult()
78 assert(abs(dx-10) <= tol)
79 assert(abs(dy-10) <= tol)
80 assert(abs(dz-10) <= tol)
81 model.testResultsVolumes(Import_2, [1000], theNbSignificantDigits = 7)
84 if __name__ == '__main__':