X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FTest%2FTestBoundingBox.py;h=e6c58c15e3376304602d97b0c5051ccd1443e8c9;hb=fc72d43b677baa05ae7fd317346fd8b723b799ed;hp=673445e8641e016a3ef9be1ca9ba6a5c82c3be76;hpb=8f29b823e6a1a407252eea9dbf110ad695c7121c;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/Test/TestBoundingBox.py b/src/FeaturesPlugin/Test/TestBoundingBox.py index 673445e86..e6c58c15e 100644 --- a/src/FeaturesPlugin/Test/TestBoundingBox.py +++ b/src/FeaturesPlugin/Test/TestBoundingBox.py @@ -1,4 +1,4 @@ -# Copyright (C) 2014-2020 CEA/DEN, EDF R&D +# Copyright (C) 2014-2023 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 @@ -36,19 +36,20 @@ __updated__ = "2020-11-12" #========================================================================= -# test Bounding Box +# test Bounding Box #========================================================================= def test_Bounding_Box(): model.begin() - file_path = os.path.join(os.getenv("DATA_DIR"),"Shapes","Step","screw.step") partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() - Import_1 = model.addImport(Part_1_doc,file_path) + ### Create Cone + Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10) + model.do() ### Create BoundingBox - BoundingBox_1 = model.getBoundingBox(Part_1_doc, model.selection("SOLID", "screw_1")) + BoundingBox_1 = model.getBoundingBox(Part_1_doc, model.selection("SOLID", "Cone_1_1")) model.end() myDelta = 1e-6 @@ -57,25 +58,25 @@ def test_Bounding_Box(): print(" Basic Properties:") print(" Wires length: ", Props[0]) print(" Surface area: ", Props[1]) - print(" Volume : ", Props[2]) - - aReflength = 0.32855301948678 + print(" Volume : ", Props[2]) + + aReflength = 200 aReslength = Props[0] assert (math.fabs(aReslength - aReflength) < myDelta), "The surface is wrong: expected = {0}, real = {1}".format(aReflength, aReslength) - aRefSurface = 0.0041640657342782 + aRefSurface = 1600 aResSurface = Props[1] assert (math.fabs(aResSurface - aRefSurface) < myDelta), "The surface is wrong: expected = {0}, real = {1}".format(aRefSurface, aResSurface) - aRefVolume = 1.6785355394103e-05 + aRefVolume = 4000 aResVolume = Props[2] assert (math.fabs(aResVolume - aRefVolume) < myDelta), "The volume is wrong: expected = {0}, real = {1}".format(aRefVolume, aResVolume) - + if __name__ == '__main__': test_Bounding_Box() - + #========================================================================= # End of test #=========================================================================