From 5cac7d767796b7593729165c1114d2cfcdf0b0df Mon Sep 17 00:00:00 2001 From: azv Date: Wed, 5 Dec 2018 12:36:22 +0300 Subject: [PATCH] [Code coverage FeaturesPlugin]: Improve coverage of Partition, Symmetry, (Multi)Rotation and (Multi)Translation features --- src/FeaturesPlugin/CMakeLists.txt | 7 ++ .../FeaturesPlugin_MultiRotation.cpp | 5 -- .../FeaturesPlugin_Rotation.cpp | 18 ++--- .../FeaturesPlugin_Symmetry.cpp | 10 --- .../FeaturesPlugin_Translation.cpp | 5 -- .../Test/TestMultiRotation_Part.py | 40 +++++++++ .../Test/TestMultiTranslation_Part.py | 40 +++++++++ .../Test/TestPlacement_ErrorMsg.py | 81 +++++++++++++++++++ .../Test/TestPlacement_Part_Part.py | 44 ++++++++++ .../Test/TestRotation_ErrorMsg.py | 80 ++++++++++++++++++ src/FeaturesPlugin/Test/TestSymmetry_Part.py | 42 ++++++++++ .../Test/TestTranslation_Part.py | 42 ++++++++++ 12 files changed, 383 insertions(+), 31 deletions(-) create mode 100644 src/FeaturesPlugin/Test/TestMultiRotation_Part.py create mode 100644 src/FeaturesPlugin/Test/TestMultiTranslation_Part.py create mode 100644 src/FeaturesPlugin/Test/TestPlacement_ErrorMsg.py create mode 100644 src/FeaturesPlugin/Test/TestPlacement_Part_Part.py create mode 100644 src/FeaturesPlugin/Test/TestRotation_ErrorMsg.py create mode 100644 src/FeaturesPlugin/Test/TestSymmetry_Part.py create mode 100644 src/FeaturesPlugin/Test/TestTranslation_Part.py diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index 1ba2b4b3a..b482ba091 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -181,8 +181,15 @@ ADD_UNIT_TESTS(TestExtrusion.py TestPlacement_Face_Vertex.py TestPlacement_Face_Edge.py TestPlacement_Face_Face.py + TestPlacement_Part_Part.py + TestPlacement_ErrorMsg.py TestTranslation.py + TestTranslation_Part.py TestRotation.py + TestRotation_ErrorMsg.py + TestMultiRotation_Part.py + TestMultiTranslation_Part.py + TestSymmetry_Part.py TestBoolean1.py TestBoolean2.py TestBoolean3.py diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp index a3af21edb..9391b36e0 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp @@ -121,11 +121,6 @@ void FeaturesPlugin_MultiRotation::performRotation1D() GeomAPI_ShapeIterator anIt(aShape); anEdge = anIt.current()->edge(); } - else - { - setError(aSelectionError); - return; - } if (!anEdge.get()) { diff --git a/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp b/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp index 8d13db5bf..7305870f4 100755 --- a/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp @@ -123,11 +123,6 @@ void FeaturesPlugin_Rotation::performTranslationByAxisAndAngle() GeomAPI_ShapeIterator anIt(aShape); anEdge = anIt.current()->edge(); } - else - { - setError(aSelectionError); - return; - } if (!anEdge.get()) { @@ -230,16 +225,17 @@ void FeaturesPlugin_Rotation::performTranslationByThreePoints() selection(FeaturesPlugin_Rotation::START_POINT_ID()); std::shared_ptr anEndPointRef = selection(FeaturesPlugin_Rotation::END_POINT_ID()); - if ((aCenterRef.get() != NULL) && (aStartPointRef.get() != NULL) - && (anEndPointRef.get() != NULL)) { + if ((aCenterRef.get() != NULL) && + (aStartPointRef.get() != NULL) && + (anEndPointRef.get() != NULL)) { GeomShapePtr aCenterShape = aCenterRef->value(); - if (!aCenterShape.get()) + if (!aCenterShape.get() && aCenterRef->context().get()) aCenterShape = aCenterRef->context()->shape(); GeomShapePtr aStartShape = aStartPointRef->value(); - if (!aStartShape.get()) + if (!aStartShape.get() && aStartPointRef->context().get()) aStartShape = aStartPointRef->context()->shape(); - GeomShapePtr anEndShape = anEndPointRef->value(); - if (!anEndShape.get()) + GeomShapePtr anEndShape = anEndPointRef->value(); + if (!anEndShape.get() && anEndPointRef->context().get()) anEndShape = anEndPointRef->context()->shape(); if (aStartShape && anEndShape && aCenterShape) { aCenterPoint = GeomAlgoAPI_PointBuilder::point(aCenterShape); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp index f2a56036f..93707eeb0 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp @@ -218,11 +218,6 @@ void FeaturesPlugin_Symmetry::performSymmetryByAxis() GeomAPI_ShapeIterator anIt(aShape); anEdge = anIt.current()->edge(); } - else - { - setError(aSelectionError); - return; - } if (!anEdge.get()) { @@ -319,11 +314,6 @@ void FeaturesPlugin_Symmetry::performSymmetryByPlane() GeomAPI_ShapeIterator anIt(aShape); aFace = anIt.current()->face(); } - else - { - setError(aSelectionError); - return; - } if (!aFace.get()) { diff --git a/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp b/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp index 95e8644c1..14de51957 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp @@ -135,11 +135,6 @@ void FeaturesPlugin_Translation::performTranslationByAxisAndDistance() GeomAPI_ShapeIterator anIt(aShape); anEdge = anIt.current()->edge(); } - else - { - setError(aSelectionError); - return; - } if (!anEdge.get()) { diff --git a/src/FeaturesPlugin/Test/TestMultiRotation_Part.py b/src/FeaturesPlugin/Test/TestMultiRotation_Part.py new file mode 100644 index 000000000..11938ae85 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestMultiRotation_Part.py @@ -0,0 +1,40 @@ +## Copyright (C) 2018-20xx 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 +## + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Box_1 = model.addBox(Part_1_doc, 10, 10, 10) +model.do() +AngularCopy_1 = model.addMultiRotation(partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("EDGE", "OZ"), 2) +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(AngularCopy_1, 2) +model.testNbSubResults(AngularCopy_1, [0, 0]) +model.testNbSubShapes(AngularCopy_1, GeomAPI_Shape.SOLID, [1, 1]) +model.testNbSubShapes(AngularCopy_1, GeomAPI_Shape.FACE, [6, 6]) +model.testNbSubShapes(AngularCopy_1, GeomAPI_Shape.EDGE, [24, 24]) +model.testNbSubShapes(AngularCopy_1, GeomAPI_Shape.VERTEX, [48, 48]) +model.testResultsVolumes(AngularCopy_1, [1000, 1000]) diff --git a/src/FeaturesPlugin/Test/TestMultiTranslation_Part.py b/src/FeaturesPlugin/Test/TestMultiTranslation_Part.py new file mode 100644 index 000000000..024087c28 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestMultiTranslation_Part.py @@ -0,0 +1,40 @@ +## Copyright (C) 2018-20xx 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 +## + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Box_1 = model.addBox(Part_1_doc, 10, 10, 10) +model.do() +LinearCopy_1 = model.addMultiTranslation(partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("EDGE", "OX"), 20, 2, model.selection("EDGE", "OY"), 20, 2) +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(LinearCopy_1, 4) +model.testNbSubResults(LinearCopy_1, [0, 0, 0, 0]) +model.testNbSubShapes(LinearCopy_1, GeomAPI_Shape.SOLID, [1, 1, 1, 1]) +model.testNbSubShapes(LinearCopy_1, GeomAPI_Shape.FACE, [6, 6, 6, 6]) +model.testNbSubShapes(LinearCopy_1, GeomAPI_Shape.EDGE, [24, 24, 24, 24]) +model.testNbSubShapes(LinearCopy_1, GeomAPI_Shape.VERTEX, [48, 48, 48, 48]) +model.testResultsVolumes(LinearCopy_1, [1000, 1000, 1000, 1000]) diff --git a/src/FeaturesPlugin/Test/TestPlacement_ErrorMsg.py b/src/FeaturesPlugin/Test/TestPlacement_ErrorMsg.py new file mode 100644 index 000000000..fe0b6cabc --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPlacement_ErrorMsg.py @@ -0,0 +1,81 @@ +## Copyright (C) 2018-20xx 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 +## + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(-16.57843122838298, -30.87163595652513, 16.88033171559421) +SketchCircle_2 = Sketch_1.addCircle(29.74848722752363, 33.32178840955915, 9.026354269133289) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) +model.do() +model.end() + +from ModelAPI import * +aSession = ModelAPI_Session.get() + +aShapeToMove = Extrusion_1.feature().results()[1] + +# Verify Placement errors on low-level +aSession.startOperation() +aPlacementFt = featureToCompositeFeature(Part_1.feature()).addFeature("Placement") +aPlacementFt.execute() +aSession.finishOperation() +assert(aPlacementFt.error() != "") + +aSession.startOperation() +aPlacementFt.selectionList("placement_objects_list").append(aShapeToMove, aShapeToMove.shape()) +aPlacementFt.execute() +aSession.finishOperation() +assert(aPlacementFt.error() != "") + +aSession.startOperation() +aPlacementFt.selection("placement_start_shape").selectSubShape("FACE", "Extrusion_1_2/To_Face") +aPlacementFt.execute() +aSession.finishOperation() +assert(aPlacementFt.error() != "") + +aSession.startOperation() +aPlacementFt.selection("placement_start_shape").selectSubShape("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchCircle_2_2") +aPlacementFt.selection("placement_end_shape").selectSubShape("FACE", "Extrusion_1_1/To_Face") +aPlacementFt.execute() +aSession.finishOperation() +assert(aPlacementFt.error() != "") + +aSession.startOperation() +aPlacementFt.selection("placement_start_shape").selectSubShape("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchCircle_2_2][Extrusion_1_2/To_Face]") +aPlacementFt.selection("placement_end_shape").selectSubShape("FACE", "Extrusion_1_1/To_Face") +aPlacementFt.execute() +aSession.finishOperation() +assert(aPlacementFt.error() != "") + +# Create correct Placement +aSession.startOperation() +aPlacementFt.selection("placement_start_shape").selectSubShape("FACE", "Extrusion_1_2/To_Face") +aPlacementFt.selection("placement_end_shape").selectSubShape("FACE", "Extrusion_1_1/To_Face") +aPlacementFt.boolean("placement_reverse_direction").setValue(False) +aPlacementFt.boolean("placement_centering").setValue(True) +aPlacementFt.execute() +aSession.finishOperation() +assert(aPlacementFt.error() == "") diff --git a/src/FeaturesPlugin/Test/TestPlacement_Part_Part.py b/src/FeaturesPlugin/Test/TestPlacement_Part_Part.py new file mode 100644 index 000000000..6f6d28f11 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPlacement_Part_Part.py @@ -0,0 +1,44 @@ +## Copyright (C) 2018-20xx 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 +## + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Box_1 = model.addBox(Part_1_doc, 10, 10, 10) +model.do() +Part_2 = model.addPart(partSet) +Part_2_doc = Part_2.document() +Cylinder_1 = model.addCylinder(Part_2_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) +model.do() +Placement_1 = model.addPlacement(partSet, [model.selection("COMPOUND", "Part_2/")], model.selection("FACE", "Part_2/Cylinder_1_1/Face_2"), model.selection("FACE", "Part_1/Box_1_1/Front"), False, True) +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Placement_1, 1) +model.testNbSubResults(Placement_1, [0]) +model.testNbSubShapes(Placement_1, GeomAPI_Shape.SOLID, [1]) +model.testNbSubShapes(Placement_1, GeomAPI_Shape.FACE, [3]) +model.testNbSubShapes(Placement_1, GeomAPI_Shape.EDGE, [6]) +model.testNbSubShapes(Placement_1, GeomAPI_Shape.VERTEX, [12]) +model.testResultsVolumes(Placement_1, [785.398163397448342948337085545]) diff --git a/src/FeaturesPlugin/Test/TestRotation_ErrorMsg.py b/src/FeaturesPlugin/Test/TestRotation_ErrorMsg.py new file mode 100644 index 000000000..0e903e586 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestRotation_ErrorMsg.py @@ -0,0 +1,80 @@ +## Copyright (C) 2018-20xx 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 +## + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Box_1 =model.addBox(Part_1_doc, 10, 10, 10) +model.end() + +from ModelAPI import * +aSession = ModelAPI_Session.get() + +aShapeToMove = Box_1.feature().lastResult() + +# Verify Rotation errors on low-level +aSession.startOperation() +aRotation = featureToCompositeFeature(Part_1.feature()).addFeature("Rotation") +aRotation.string("CreationMethod").setValue("ByAxisAndAngle") +aRotation.execute() +aSession.finishOperation() +assert(aRotation.error() != "") + +aSession.startOperation() +aRotation.selectionList("main_objects").append(aShapeToMove, aShapeToMove.shape()) +aRotation.execute() +aSession.finishOperation() +assert(aRotation.error() != "") + +aSession.startOperation() +aRotation.selectionList("main_objects").append(None, None) +aRotation.execute() +aSession.finishOperation() +assert(aRotation.error() != "") + +aSession.startOperation() +aRotation.string("CreationMethod").setValue("ByThreePoints") +aRotation.execute() +aSession.finishOperation() +assert(aRotation.error() != "") + +aSession.startOperation() +aRotation.selectionList("main_objects").removeLast() +aRotation.selectionList("main_objects").removeLast() +aRotation.execute() +aSession.finishOperation() +assert(aRotation.error() != "") + +aSession.startOperation() +aRotation.selectionList("main_objects").append(aShapeToMove, aShapeToMove.shape()) +aRotation.string("CreationMethod").setValue("ByAxisAndAngle") +aRotation.selection("axis_object").selectSubShape("FACE", "Box_1_1/Back") +aRotation.execute() +aSession.finishOperation() +assert(aRotation.error() != "") + +aSession.startOperation() +aRotation.selection("axis_object").selectSubShape("COMPOUND", "Box_1_1/Back") +aRotation.execute() +aSession.finishOperation() +assert(aRotation.error() != "") diff --git a/src/FeaturesPlugin/Test/TestSymmetry_Part.py b/src/FeaturesPlugin/Test/TestSymmetry_Part.py new file mode 100644 index 000000000..c8801f19f --- /dev/null +++ b/src/FeaturesPlugin/Test/TestSymmetry_Part.py @@ -0,0 +1,42 @@ +## Copyright (C) 2018-20xx 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 +## + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Box_1 = model.addBox(Part_1_doc, 10, 10, 10) +model.do() +Symmetry_1 = model.addSymmetry(partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("VERTEX", "Part_1/[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"), False) +Symmetry_2 = model.addSymmetry(partSet, [model.selection("COMPOUND", "Symmetry_1/")], model.selection("EDGE", "Symmetry_1/[Box_1_1/Back][Box_1_1/Left]"), False) +Symmetry_3 = model.addSymmetry(partSet, [model.selection("COMPOUND", "Symmetry_2/")], model.selection("FACE", "Symmetry_2/Box_1_1/Bottom"), False) +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Symmetry_3, 1) +model.testNbSubResults(Symmetry_3, [0]) +model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.SOLID, [1]) +model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.FACE, [6]) +model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.EDGE, [24]) +model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.VERTEX, [48]) +model.testResultsVolumes(Symmetry_3, [1000]) diff --git a/src/FeaturesPlugin/Test/TestTranslation_Part.py b/src/FeaturesPlugin/Test/TestTranslation_Part.py new file mode 100644 index 000000000..f50e57578 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestTranslation_Part.py @@ -0,0 +1,42 @@ +## Copyright (C) 2018-20xx 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 +## + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Box_1 = model.addBox(Part_1_doc, 10, 10, 10) +model.do() +Translation_1 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("EDGE", "OX"), 10) +Translation_2 = model.addTranslation(partSet, [model.selection("COMPOUND", "Translation_1/")], 0, 10, 0) +Translation_3 = model.addTranslation(partSet, [model.selection("COMPOUND", "Translation_2/")], model.selection("VERTEX", "Translation_2/[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"), model.selection("VERTEX", "Translation_2/[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]")) +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Translation_1, 1) +model.testNbSubResults(Translation_1, [0]) +model.testNbSubShapes(Translation_1, GeomAPI_Shape.SOLID, [1]) +model.testNbSubShapes(Translation_1, GeomAPI_Shape.FACE, [6]) +model.testNbSubShapes(Translation_1, GeomAPI_Shape.EDGE, [24]) +model.testNbSubShapes(Translation_1, GeomAPI_Shape.VERTEX, [48]) +model.testResultsVolumes(Translation_1, [1000]) -- 2.39.2