From: cg246364 Date: Thu, 29 Jul 2021 13:56:57 +0000 (+0200) Subject: Finalaisation de l'API et des tests pour le volume X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0c91eb95a7e1752f9448421417d35aa2a98e84f8;p=modules%2Fshaper.git Finalaisation de l'API et des tests pour le volume --- diff --git a/src/OperaAPI/OperaAPI_Volume.cpp b/src/OperaAPI/OperaAPI_Volume.cpp index c50fcb7eb..a06cdf7cc 100644 --- a/src/OperaAPI/OperaAPI_Volume.cpp +++ b/src/OperaAPI/OperaAPI_Volume.cpp @@ -55,7 +55,7 @@ void OperaAPI_Volume::setMedium(const ModelHighAPI_Double& theMedium) //================================================================================================== void OperaAPI_Volume::setObjectList(const std::list& theObjectList) { - fillAttribute(theObjectList, myvolumeList); + fillAttribute(theObjectList, volumeList()); execute(); } @@ -70,12 +70,7 @@ void OperaAPI_Volume::dump(ModelHighAPI_Dumper& theDumper) const theDumper << aBase << " = model.addVolume(" << aDocName << ", " << anAttrMedium << ", "; AttributeSelectionListPtr anAttrList = aBase->selectionList(OperaPlugin_Volume::VOLUME_LIST_ID()); - if (anAttrList->isWholeResultAllowed() && !anAttrList->selectionType().empty()) - theDumper<<"\""<selectionType()<<"\", "; - theDumper << anAttrList; - if (anAttrList->isGeometricalSelection()) - theDumper <<", True"; - theDumper << ")" << std::endl; + theDumper << anAttrList << ")" << std::endl; } //================================================================================================== diff --git a/src/OperaPlugin/Test/TestVolume.py b/src/OperaPlugin/Test/TestVolume.py index 79a3f55de..e199da673 100755 --- a/src/OperaPlugin/Test/TestVolume.py +++ b/src/OperaPlugin/Test/TestVolume.py @@ -31,54 +31,35 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -#========================================================================= -# Create a Box, a Torus and a Cylinder -#========================================================================= +### Create a box Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Torus_1 = model.addTorus(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 15, 3) + +### Create a cylinder Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -#========================================================================= -# Create one Volume -#========================================================================= +### Create a sphere +Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 10) -Volume_1 = model.addVolume(Part_1_doc, "Test_medium", [model.selection("SOLID", "Box_1")]) +### Create a volume from the box +Volume_1 = model.addVolume(Part_1_doc, "dede", [model.selection("SOLID", "Box_1_1")]) -#========================================================================= -# Check results -#========================================================================= +### Create a volume from the cylinder and the sphere +Volume_2 = model.addVolume(Part_1_doc, "frgt", [model.selection("SOLID", "Cylinder_1_1"), model.selection("SOLID", "Sphere_1_1")]) +# Checks from GeomAPI import GeomAPI_Shape -print("TOTO") -print(len(Volume_1.results())) -#model.testNbResults(Volume_1, 1) -#model.testNbSubResults(Volume_1, [0]) -#model.testNbSubShapes(Volume_1, GeomAPI_Shape.SOLID, [1]) -#model.testNbSubShapes(Volume_1, GeomAPI_Shape.FACE, [6]) -#model.testHaveNamingFaces(Volume_1, model, Part_1_doc) - -#========================================================================= -# Create two volumes at once -#========================================================================= - -Volume_2 = model.addVolume(Part_1_doc, "Test_medium_2", [model.selection("SOLID", "Torus_1"), - model.selection("SOLID", "Cylinder_1")]) - -#========================================================================= -# Check results -#========================================================================= +model.testNbResults(Volume_1, 1) +model.testNbSubResults(Volume_1, [0]) +model.testNbSubShapes(Volume_1, GeomAPI_Shape.SOLID, [1]) +model.testNbSubShapes(Volume_1, GeomAPI_Shape.FACE, [6]) +model.testHaveNamingFaces(Volume_1, model, Part_1_doc) -print(len(Volume_2.results())) -#model.testNbResults(Volume_2, 2) -# model.testNbSubResults(Volume_2, [0]) -# model.testNbSubShapes(Volume_2, GeomAPI_Shape.SOLID, [1]) -# model.testNbSubShapes(Volume_2, GeomAPI_Shape.FACE, [6]) -# model.testHaveNamingFaces(Volume_2, model, Part_1_doc) +model.testNbResults(Volume_2, 2) +model.testNbSubResults(Volume_2, [0, 0]) +model.testNbSubShapes(Volume_2, GeomAPI_Shape.SOLID, [1, 1]) +model.testNbSubShapes(Volume_2, GeomAPI_Shape.FACE, [3, 1]) #========================================================================= # End of test #========================================================================= - -from salome.shaper import model -#assert(model.checkPythonDump())