Salome HOME
[Code coverage FeaturesPlugin]: Improve coverage of Partition, Symmetry, (Multi)Rotat...
authorazv <azv@opencascade.com>
Wed, 5 Dec 2018 09:36:22 +0000 (12:36 +0300)
committerazv <azv@opencascade.com>
Wed, 5 Dec 2018 10:45:33 +0000 (13:45 +0300)
12 files changed:
src/FeaturesPlugin/CMakeLists.txt
src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp
src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp
src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp
src/FeaturesPlugin/FeaturesPlugin_Translation.cpp
src/FeaturesPlugin/Test/TestMultiRotation_Part.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestMultiTranslation_Part.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestPlacement_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestPlacement_Part_Part.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestRotation_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestSymmetry_Part.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestTranslation_Part.py [new file with mode: 0644]

index 1ba2b4b3a549ffd47476eee08f9c1a6f791a1ea6..b482ba091b0f2275b33deefe3deffc6befb077e0 100644 (file)
@@ -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
index a3af21edbd8e232a738ff00d5fc463f704d7c6ea..9391b36e0f5ea0b58a0f2fbd584f8a32d4a42fe4 100644 (file)
@@ -121,11 +121,6 @@ void FeaturesPlugin_MultiRotation::performRotation1D()
     GeomAPI_ShapeIterator anIt(aShape);
     anEdge = anIt.current()->edge();
   }
-  else
-  {
-    setError(aSelectionError);
-    return;
-  }
 
   if (!anEdge.get())
   {
index 8d13db5bfb76550245b8dbf096417a54ace53dc2..7305870f46bd44115d6c50f5f46ae31587a84769 100755 (executable)
@@ -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<ModelAPI_AttributeSelection> 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);
index f2a56036fb1da37968a2de87b3e2895a18706d7a..93707eeb088c68f9c4e1bad04537aec6afd77921 100644 (file)
@@ -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())
   {
index 95e8644c19c99d7ef6749c9f4ae13f9438e158fb..14de51957495cab9d5ece56bf93838060611d125 100644 (file)
@@ -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 (file)
index 0000000..11938ae
--- /dev/null
@@ -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<mailto: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 (file)
index 0000000..024087c
--- /dev/null
@@ -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<mailto: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 (file)
index 0000000..fe0b6ca
--- /dev/null
@@ -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<mailto: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 (file)
index 0000000..6f6d28f
--- /dev/null
@@ -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<mailto: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 (file)
index 0000000..0e903e5
--- /dev/null
@@ -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<mailto: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 (file)
index 0000000..c8801f1
--- /dev/null
@@ -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<mailto: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 (file)
index 0000000..f50e575
--- /dev/null
@@ -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<mailto: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])