From 617b60d373dd1a766a14c6715777802af8d66bc7 Mon Sep 17 00:00:00 2001 From: azv Date: Thu, 20 Sep 2018 15:37:29 +0300 Subject: [PATCH] Issue #2611: Partition of a solid belonging to a Compsolid --- src/FeaturesPlugin/CMakeLists.txt | 18 ++ .../FeaturesPlugin_Partition.cpp | 276 +++++++++++++++--- ...TestPartitionSubCompsolidWithCompSolid1.py | 87 ++++++ ...TestPartitionSubCompsolidWithCompSolid2.py | 87 ++++++ ...TestPartitionSubCompsolidWithCompSolid3.py | 87 ++++++ .../TestPartitionSubCompsolidWithFace1.py | 82 ++++++ .../TestPartitionSubCompsolidWithFace2.py | 82 ++++++ .../TestPartitionSubCompsolidWithFace3.py | 82 ++++++ .../TestPartitionSubCompsolidWithFace4.py | 82 ++++++ .../TestPartitionSubCompsolidWithFace5.py | 82 ++++++ .../TestPartitionSubCompsolidWithPlane1.py | 71 +++++ .../TestPartitionSubCompsolidWithPlane2.py | 71 +++++ .../TestPartitionSubCompsolidWithPlane3.py | 72 +++++ .../TestPartitionSubCompsolidWithPlane4.py | 71 +++++ .../TestPartitionSubCompsolidWithPlane5.py | 71 +++++ .../TestPartitionSubCompsolidWithSolid1.py | 83 ++++++ .../TestPartitionSubCompsolidWithSolid2.py | 83 ++++++ .../TestPartitionSubCompsolidWithSolid3.py | 83 ++++++ .../TestPartitionSubCompsolidWithSolid4.py | 83 ++++++ .../TestPartitionSubCompsolidWithSolid5.py | 83 ++++++ 20 files changed, 1688 insertions(+), 48 deletions(-) create mode 100644 src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid1.py create mode 100644 src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid2.py create mode 100644 src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid3.py create mode 100644 src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace1.py create mode 100644 src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace2.py create mode 100644 src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace3.py create mode 100644 src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace4.py create mode 100644 src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace5.py create mode 100644 src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane1.py create mode 100644 src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane2.py create mode 100644 src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane3.py create mode 100644 src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane4.py create mode 100644 src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane5.py create mode 100644 src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid1.py create mode 100644 src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid2.py create mode 100644 src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid3.py create mode 100644 src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid4.py create mode 100644 src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid5.py diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index bf278d767..b118cd42e 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -333,4 +333,22 @@ ADD_UNIT_TESTS(TestExtrusion.py Test2592.py Test2588.py Test1467.py + TestPartitionSubCompsolidWithCompsolid1.py + TestPartitionSubCompsolidWithCompsolid2.py + TestPartitionSubCompsolidWithCompsolid3.py + TestPartitionSubCompsolidWithSolid1.py + TestPartitionSubCompsolidWithSolid2.py + TestPartitionSubCompsolidWithSolid3.py + TestPartitionSubCompsolidWithSolid4.py + TestPartitionSubCompsolidWithSolid5.py + TestPartitionSubCompsolidWithFace1.py + TestPartitionSubCompsolidWithFace2.py + TestPartitionSubCompsolidWithFace3.py + TestPartitionSubCompsolidWithFace4.py + TestPartitionSubCompsolidWithFace5.py + TestPartitionSubCompsolidWithPlane1.py + TestPartitionSubCompsolidWithPlane2.py + TestPartitionSubCompsolidWithPlane3.py + TestPartitionSubCompsolidWithPlane4.py + TestPartitionSubCompsolidWithPlane5.py ) diff --git a/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp b/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp index afb763fc6..92658389c 100755 --- a/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp @@ -20,21 +20,23 @@ #include "FeaturesPlugin_Partition.h" -#include -#include #include -#include #include +#include +#include #include +#include +#include #include -#include #include +#include #include +#include #include -#include #include #include +#include #include #include @@ -42,13 +44,32 @@ #include #include +#include #include +typedef std::list > CompsolidSubs; + static GeomShapePtr findBase(const GeomShapePtr theObjectShape, const GeomShapePtr theResultShape, const GeomAPI_Shape::ShapeType theShapeType, const std::shared_ptr theMakeShape); +static void pullObjectsAndPlanes(const AttributeSelectionListPtr& theSelectedList, + CompsolidSubs& theObjects, ListOfShape& thePlanes); + +static void resizePlanes(const CompsolidSubs& theObjects, ListOfShape& thePlanes, + std::shared_ptr& theMakeShapeList); + +static void unusedSubsOfComposolid(const CompsolidSubs& theObjects, CompsolidSubs& theNotUsed); + +static bool cutUnusedSubs(CompsolidSubs& theObjects, CompsolidSubs& theNotUsed, + std::shared_ptr& theMakeShapeList, + std::string& theError); + +static bool isAlgoFailed(const std::shared_ptr& theAlgo, + std::string& theError); + + //================================================================================================= FeaturesPlugin_Partition::FeaturesPlugin_Partition() { @@ -63,74 +84,82 @@ void FeaturesPlugin_Partition::initAttributes() //================================================================================================= void FeaturesPlugin_Partition::execute() { - ListOfShape anObjects, aPlanes; + CompsolidSubs anObjects; + ListOfShape aPlanes; // Getting objects. - AttributeSelectionListPtr anObjectsSelList = selectionList(BASE_OBJECTS_ID()); - for(int anIndex = 0; anIndex < anObjectsSelList->size(); ++anIndex) { - AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anIndex); - GeomShapePtr anObject = anObjectAttr->value(); - if(!anObject.get()) { - // It could be a construction plane. - ResultPtr aContext = anObjectAttr->context(); - aPlanes.push_back(anObjectAttr->context()->shape()); - } else { - anObjects.push_back(anObject); - } - } - + pullObjectsAndPlanes(selectionList(BASE_OBJECTS_ID()), anObjects, aPlanes); if(anObjects.empty()) { static const std::string aFeatureError = "Error: No objects for partition."; setError(aFeatureError); return; } - std::list > aBoundingPoints = - GeomAlgoAPI_ShapeTools::getBoundingBox(anObjects, 1.0); + ListOfShape aBaseObjects; + for (CompsolidSubs::iterator anIt = anObjects.begin(); anIt != anObjects.end(); ++anIt) + aBaseObjects.insert(aBaseObjects.end(), anIt->second.begin(), anIt->second.end()); + aBaseObjects.insert(aBaseObjects.end(), aPlanes.begin(), aPlanes.end()); - // Resize planes. - ListOfShape aTools; + // resize planes to the bounding box of operated shapes std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); - for(ListOfShape::const_iterator anIt = aPlanes.cbegin(); anIt != aPlanes.cend(); ++anIt) { - GeomShapePtr aPlane = *anIt; - GeomShapePtr aTool = GeomAlgoAPI_ShapeTools::fitPlaneToBox(aPlane, aBoundingPoints); - std::shared_ptr aMkShCustom(new GeomAlgoAPI_MakeShapeCustom); - aMkShCustom->addModified(aPlane, aTool); - aMakeShapeList->appendAlgo(aMkShCustom); - aTools.push_back(aTool); + resizePlanes(anObjects, aPlanes, aMakeShapeList); + + // cut unused solids of composolids from the objects of partition + CompsolidSubs anUnusedSubs; + unusedSubsOfComposolid(anObjects, anUnusedSubs); + for (CompsolidSubs::iterator anIt = anUnusedSubs.begin(); anIt != anUnusedSubs.end(); ++anIt) + aBaseObjects.insert(aBaseObjects.end(), anIt->second.begin(), anIt->second.end()); + + std::string aError; + if (!cutUnusedSubs(anObjects, anUnusedSubs, aMakeShapeList, aError)) { + setError(aError); + return; } - // Create single result. + // perform partition first time to split target solids + ListOfShape aTargetObjects; + for (CompsolidSubs::iterator anIt = anObjects.begin(); anIt != anObjects.end(); ++anIt) + aTargetObjects.insert(aTargetObjects.end(), anIt->second.begin(), anIt->second.end()); + std::shared_ptr aPartitionAlgo( - new GeomAlgoAPI_Partition(anObjects, aTools)); + new GeomAlgoAPI_Partition(aTargetObjects, aPlanes)); // Checking that the algorithm worked properly. - if (!aPartitionAlgo->isDone()) { - static const std::string aFeatureError = "Error: Partition algorithm failed."; - setError(aFeatureError); - return; - } - if (aPartitionAlgo->shape()->isNull()) { - static const std::string aShapeError = "Error: Resulting shape is Null."; - setError(aShapeError); - return; - } - if (!aPartitionAlgo->isValid()) { - std::string aFeatureError = "Error: Resulting shape is not valid."; - setError(aFeatureError); + if (isAlgoFailed(aPartitionAlgo, aError)) { + setError(aError); return; } + aMakeShapeList->appendAlgo(aPartitionAlgo); GeomShapePtr aResultShape = aPartitionAlgo->shape(); + if (!anUnusedSubs.empty()) { + // second pass of a partition to split shared faces of compsolids + aTargetObjects.clear(); + aTargetObjects.push_back(aResultShape); + for (CompsolidSubs::iterator anIt = anUnusedSubs.begin(); anIt != anUnusedSubs.end(); ++anIt) + aTargetObjects.insert(aTargetObjects.end(), anIt->second.begin(), anIt->second.end()); + + aPartitionAlgo.reset(new GeomAlgoAPI_Partition(aTargetObjects, ListOfShape())); + + // Checking that the algorithm worked properly. + if (isAlgoFailed(aPartitionAlgo, aError)) { + setError(aError); + return; + } + + aMakeShapeList->appendAlgo(aPartitionAlgo); + aResultShape = aPartitionAlgo->shape(); + } + int aResultIndex = 0; if(aResultShape->shapeType() == GeomAPI_Shape::COMPOUND) { for(GeomAPI_ShapeIterator anIt(aResultShape); anIt.more(); anIt.next()) { - storeResult(anObjects, aPlanes, anIt.current(), aMakeShapeList, aResultIndex); + storeResult(aBaseObjects, aPlanes, anIt.current(), aMakeShapeList, aResultIndex); ++aResultIndex; } } else { - storeResult(anObjects, aPlanes, aResultShape, aMakeShapeList, aResultIndex); + storeResult(aBaseObjects, aPlanes, aResultShape, aMakeShapeList, aResultIndex); ++aResultIndex; } @@ -201,7 +230,8 @@ void FeaturesPlugin_Partition::storeResult( } -//================================================================================================= +//================= Auxiliary functions =================================================== + GeomShapePtr findBase(const GeomShapePtr theObjectShape, const GeomShapePtr theResultShape, const GeomAPI_Shape::ShapeType theShapeType, @@ -233,3 +263,153 @@ GeomShapePtr findBase(const GeomShapePtr theObjectShape, return aBaseShape; } + +static CompsolidSubs::iterator findOrAdd(CompsolidSubs& theList, const GeomShapePtr& theCompsolid) +{ + CompsolidSubs::iterator aFound = theList.begin(); + for (; aFound != theList.end(); ++aFound) + if (aFound->first == theCompsolid) + break; + if (aFound == theList.end()) { + theList.push_back(std::pair(theCompsolid, ListOfShape())); + aFound = --theList.end(); + } + return aFound; +} + +void pullObjectsAndPlanes(const AttributeSelectionListPtr& theSelectedList, + CompsolidSubs& theObjects, ListOfShape& thePlanes) +{ + std::map aMapCompsolidShape; + + int aSize = theSelectedList->size(); + for (int anIndex = 0; anIndex < aSize; ++anIndex) { + AttributeSelectionPtr anObjectAttr = theSelectedList->value(anIndex); + ResultPtr aContext = anObjectAttr->context(); + GeomShapePtr anObject = anObjectAttr->value(); + if (anObject) { + GeomShapePtr anOwnerShape = anObject; + // check the result is a compsolid and store all used subs in a single list + ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext); + if (aResCompSolidPtr && aResCompSolidPtr->shape()->shapeType() == GeomAPI_Shape::COMPSOLID) { + std::map::const_iterator + aFound = aMapCompsolidShape.find(aResCompSolidPtr); + if (aFound != aMapCompsolidShape.end()) + anOwnerShape = aFound->second; + else { + anOwnerShape = aResCompSolidPtr->shape(); + aMapCompsolidShape[aResCompSolidPtr] = anOwnerShape; + } + } + + CompsolidSubs::iterator aFound = findOrAdd(theObjects, anOwnerShape); + aFound->second.push_back(anObject); + } + else { + // It could be a construction plane. + thePlanes.push_back(anObjectAttr->context()->shape()); + } + } +} + +void resizePlanes(const CompsolidSubs& theObjects, ListOfShape& thePlanes, + std::shared_ptr& theMakeShapeList) +{ + ListOfShape aSolidsInOperation; + for (CompsolidSubs::const_iterator anIt = theObjects.begin(); anIt != theObjects.end(); ++anIt) + aSolidsInOperation.insert(aSolidsInOperation.end(), anIt->second.begin(), anIt->second.end()); + + std::list > aBoundingPoints = + GeomAlgoAPI_ShapeTools::getBoundingBox(aSolidsInOperation, 1.0); + + ListOfShape aPlanesCopy = thePlanes; + thePlanes.clear(); + + // Resize planes to fit in bounding box + for (ListOfShape::const_iterator anIt = aPlanesCopy.begin(); anIt != aPlanesCopy.end(); ++anIt) { + GeomShapePtr aPlane = *anIt; + GeomShapePtr aTool = GeomAlgoAPI_ShapeTools::fitPlaneToBox(aPlane, aBoundingPoints); + std::shared_ptr aMkShCustom(new GeomAlgoAPI_MakeShapeCustom); + aMkShCustom->addModified(aPlane, aTool); + theMakeShapeList->appendAlgo(aMkShCustom); + thePlanes.push_back(aTool); + } +} + +void unusedSubsOfComposolid(const CompsolidSubs& theObjects, CompsolidSubs& theNotUsed) +{ + for (CompsolidSubs::const_iterator aCSIt = theObjects.begin(); + aCSIt != theObjects.end(); ++aCSIt) { + if (aCSIt->first->shapeType() != GeomAPI_Shape::COMPSOLID) + continue; + + ListOfShape aNotUsedSolids; + for (GeomAPI_ShapeExplorer anExp(aCSIt->first, GeomAPI_Shape::SOLID); + anExp.more(); anExp.next()) { + GeomShapePtr aSolidInCompSolid = anExp.current(); + ListOfShape::const_iterator anIt = aCSIt->second.begin(); + for (; anIt != aCSIt->second.end(); ++anIt) + if (aSolidInCompSolid->isEqual(*anIt)) + break; + + if (anIt == aCSIt->second.end()) + aNotUsedSolids.push_back(aSolidInCompSolid); + } + + if (!aNotUsedSolids.empty()) + theNotUsed.push_back(std::pair(aCSIt->first, aNotUsedSolids)); + } +} + +bool cutUnusedSubs(CompsolidSubs& theObjects, CompsolidSubs& theNotUsed, + std::shared_ptr& theMakeShapeList, + std::string& theError) +{ + std::shared_ptr aCutAlgo; + + for (CompsolidSubs::iterator anObjIt = theObjects.begin(); + anObjIt != theObjects.end(); ++anObjIt) { + // get list of unused subs of composolids except the current + ListOfShape aTools; + for (CompsolidSubs::const_iterator aUIt = theNotUsed.begin(); + aUIt != theNotUsed.end(); ++aUIt) { + if (aUIt->first != anObjIt->first) + aTools.insert(aTools.end(), aUIt->second.begin(), aUIt->second.end()); + } + if (aTools.empty()) + continue; + + // cut from current list of solids + aCutAlgo.reset( + new GeomAlgoAPI_Boolean(anObjIt->second, aTools, GeomAlgoAPI_Boolean::BOOL_CUT)); + if (isAlgoFailed(aCutAlgo, theError)) + return false; + theMakeShapeList->appendAlgo(aCutAlgo); + + // update list of objects of the partition + GeomAPI_Shape::ShapeType aType = anObjIt->second.front()->shapeType(); + anObjIt->second.clear(); + for (GeomAPI_ShapeExplorer anExp(aCutAlgo->shape(), aType); anExp.more(); anExp.next()) + anObjIt->second.push_back(anExp.current()); + } + return true; +} + +bool isAlgoFailed(const std::shared_ptr& theAlgo, std::string& theError) +{ + if (!theAlgo->isDone()) { + theError = "Error: Partition algorithm failed."; + return true; + } + if (theAlgo->shape()->isNull()) { + theError = "Error: Resulting shape is Null."; + return true; + } + if (!theAlgo->isValid()) { + theError = "Error: Resulting shape is not valid."; + return true; + } + + theError.clear(); + return false; +} diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid1.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid1.py new file mode 100644 index 000000000..9b428d6b5 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid1.py @@ -0,0 +1,87 @@ +## 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 +from GeomAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Param_BoxH = model.addParameter(Part_1_doc, "BoxHeight", "10") +Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0") +Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10") +Param_Radius = model.addParameter(Part_1_doc, "Radius", "40") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) +SketchCircle_2 = Sketch_1.addCircle(55, 30, 40) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin") +Box_1 = model.addBox(Part_1_doc, 80, 80, "BoxHeight") +Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Right")) +Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Front")) +Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")] +Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects) +Partition_2 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Partition_1_1_3")]) +model.do() + +# check partition +model.testNbResults(Partition_2, 1) +model.testNbSubResults(Partition_2, [9]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.SOLID, [9]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.FACE, [61]) +model.testResultsVolumes(Partition_2, [82157.197962046673637814819812775]) + +# change box height and check partition +Param_BoxH.setValue(20) +model.do() + +model.testNbResults(Partition_2, 1) +model.testNbSubResults(Partition_2, [10]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.SOLID, [10]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.FACE, [73]) +model.testResultsVolumes(Partition_2, [146157.197962002450367435812950134]) + +# update extrusion and check partition +Param_ExtrusionMin.setValue(-5) +Param_ExtrusionMax.setValue(15) +model.do() + +model.testNbResults(Partition_2, 1) +model.testNbSubResults(Partition_2, [11]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.SOLID, [11]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.FACE, [85]) +model.testResultsVolumes(Partition_2, [146157.197961971396580338478088379]) + +# change radius of a circle and check partition +Param_Radius.setValue(50) +model.do() + +model.testNbResults(Partition_2, 1) +model.testNbSubResults(Partition_2, [11]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.SOLID, [11]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.FACE, [82]) +model.testResultsVolumes(Partition_2, [156418.581829168775584548711776733]) + +# check naming +model.testHaveNamingSubshapes(Partition_2, model, Part_1_doc) + +model.end() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid2.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid2.py new file mode 100644 index 000000000..38b4094d2 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid2.py @@ -0,0 +1,87 @@ +## 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 +from GeomAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Param_BoxH = model.addParameter(Part_1_doc, "BoxHeight", "10") +Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0") +Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10") +Param_Radius = model.addParameter(Part_1_doc, "Radius", "40") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) +SketchCircle_2 = Sketch_1.addCircle(55, 30, 40) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin") +Box_1 = model.addBox(Part_1_doc, 80, 80, "BoxHeight") +Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Right")) +Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Front")) +Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")] +Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects) +Partition_2 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Partition_1_1_3")]) +model.do() + +# check partition +model.testNbResults(Partition_2, 1) +model.testNbSubResults(Partition_2, [8]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.SOLID, [8]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.FACE, [55]) +model.testResultsVolumes(Partition_2, [82157.197962275837198831140995026]) + +# change box height and check partition +Param_BoxH.setValue(20) +model.do() + +model.testNbResults(Partition_2, 1) +model.testNbSubResults(Partition_2, [9]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.SOLID, [9]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.FACE, [70]) +model.testResultsVolumes(Partition_2, [146157.197962169535458087921142578]) + +# update extrusion and check partition +Param_ExtrusionMin.setValue(-5) +Param_ExtrusionMax.setValue(15) +model.do() + +model.testNbResults(Partition_2, 1) +model.testNbSubResults(Partition_2, [10]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.SOLID, [10]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.FACE, [85]) +model.testResultsVolumes(Partition_2, [146157.197962103120516985654830933]) + +# change radius of a circle and check partition +Param_Radius.setValue(50) +model.do() + +model.testNbResults(Partition_2, 1) +model.testNbSubResults(Partition_2, [11]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.SOLID, [11]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.FACE, [86]) +model.testResultsVolumes(Partition_2, [156418.58182917608064599335193634]) + +# check naming +model.testHaveNamingSubshapes(Partition_2, model, Part_1_doc) + +model.end() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid3.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid3.py new file mode 100644 index 000000000..a466e5e96 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithCompSolid3.py @@ -0,0 +1,87 @@ +## 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 +from GeomAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Param_BoxH = model.addParameter(Part_1_doc, "BoxHeight", "10") +Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0") +Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10") +Param_Radius = model.addParameter(Part_1_doc, "Radius", "40") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) +SketchCircle_2 = Sketch_1.addCircle(55, 30, 40) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin") +Box_1 = model.addBox(Part_1_doc, 80, 80, "BoxHeight") +Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Right")) +Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Front")) +Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")] +Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects) +Partition_2 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("SOLID", "Partition_1_1_3")]) +model.do() + +# check partition +model.testNbResults(Partition_2, 1) +model.testNbSubResults(Partition_2, [9]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.SOLID, [9]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.FACE, [61]) +model.testResultsVolumes(Partition_2, [82157.197962205173098482191562653]) + +# change box height and check partition +Param_BoxH.setValue(20) +model.do() + +model.testNbResults(Partition_2, 1) +model.testNbSubResults(Partition_2, [10]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.SOLID, [10]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.FACE, [75]) +model.testResultsVolumes(Partition_2, [146157.197962133242981508374214172]) + +# update extrusion and check partition +Param_ExtrusionMin.setValue(-5) +Param_ExtrusionMax.setValue(15) +model.do() + +model.testNbResults(Partition_2, 1) +model.testNbSubResults(Partition_2, [11]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.SOLID, [11]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.FACE, [89]) +model.testResultsVolumes(Partition_2, [146157.197962085192557424306869507]) + +# change radius of a circle and check partition +Param_Radius.setValue(50) +model.do() + +model.testNbResults(Partition_2, 1) +model.testNbSubResults(Partition_2, [11]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.SOLID, [11]) +model.testNbSubShapes(Partition_2, GeomAPI_Shape.FACE, [86]) +model.testResultsVolumes(Partition_2, [156418.581829176022438332438468933]) + +# check naming +model.testHaveNamingSubshapes(Partition_2, model, Part_1_doc) + +model.end() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace1.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace1.py new file mode 100644 index 000000000..1e178975d --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace1.py @@ -0,0 +1,82 @@ +## 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 +from GeomAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0") +Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10") +Param_Radius = model.addParameter(Part_1_doc, "Radius", "40") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) +SketchCircle_2 = Sketch_1.addCircle(55, 30, 40) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin") +Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) +SketchArc_1 = Sketch_2.addArc(10.01336797518561, 24.95055816041118, 7.898114670281987, -23.85096600991564, 58.22303946797933, 32.81761798074749, False) +SketchArc_1.result().setColor(225, 0, 0) +SketchArc_1.results()[1].setColor(225, 0, 0) +SketchLine_1 = Sketch_2.addLine(58.22303949051827, 32.8176179844255, 7.898114670281987, -23.85096600991564) +SketchLine_1.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) +model.do() +Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), 90, 0) +Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_2")]) +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("FACE", "Face_1_1")]) +model.do() + +# check partition +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [2]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [26]) +model.testResultsVolumes(Partition_1, [61838.592736754246288910508155823]) + +# update extrusion and check partition +Param_ExtrusionMin.setValue(-5) +Param_ExtrusionMax.setValue(15) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [2]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [3]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [23]) +model.testResultsVolumes(Partition_1, [60961.060159030253998935222625732]) + +# change radius of a circle and check partition +Param_Radius.setValue(50) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [2]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [3]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [23]) +model.testResultsVolumes(Partition_1, [83608.865629965730477124452590942]) + +# check naming +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) + +model.end() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace2.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace2.py new file mode 100644 index 000000000..df19bc5b2 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace2.py @@ -0,0 +1,82 @@ +## 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 +from GeomAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0") +Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10") +Param_Radius = model.addParameter(Part_1_doc, "Radius", "40") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) +SketchCircle_2 = Sketch_1.addCircle(55, 30, 40) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin") +Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) +SketchArc_1 = Sketch_2.addArc(10.01336797518561, 24.95055816041118, 7.898114670281987, -23.85096600991564, 58.22303946797933, 32.81761798074749, False) +SketchArc_1.result().setColor(225, 0, 0) +SketchArc_1.results()[1].setColor(225, 0, 0) +SketchLine_1 = Sketch_2.addLine(58.22303949051827, 32.8176179844255, 7.898114670281987, -23.85096600991564) +SketchLine_1.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) +model.do() +Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), 90, 0) +Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_2")]) +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("FACE", "Face_1_1")]) +model.do() + +# check partition +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [2]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [3]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [22]) +model.testResultsVolumes(Partition_1, [61945.742345225989993195980787277]) + +# update extrusion and check partition +Param_ExtrusionMin.setValue(-5) +Param_ExtrusionMax.setValue(15) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [2]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [3]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [21]) +model.testResultsVolumes(Partition_1, [60999.340090954778133891522884369]) + +# change radius of a circle and check partition +Param_Radius.setValue(50) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [2]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [3]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [21]) +model.testResultsVolumes(Partition_1, [83593.613567417080048471689224243]) + +# check naming +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) + +model.end() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace3.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace3.py new file mode 100644 index 000000000..2c8626bcd --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace3.py @@ -0,0 +1,82 @@ +## 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 +from GeomAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0") +Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10") +Param_Radius = model.addParameter(Part_1_doc, "Radius", "40") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) +SketchCircle_2 = Sketch_1.addCircle(55, 30, 40) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin") +Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) +SketchArc_1 = Sketch_2.addArc(10.01336797518561, 24.95055816041118, 7.898114670281987, -23.85096600991564, 58.22303946797933, 32.81761798074749, False) +SketchArc_1.result().setColor(225, 0, 0) +SketchArc_1.results()[1].setColor(225, 0, 0) +SketchLine_1 = Sketch_2.addLine(58.22303949051827, 32.8176179844255, 7.898114670281987, -23.85096600991564) +SketchLine_1.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) +model.do() +Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), 90, 0) +Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_2")]) +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "Face_1_1")]) +model.do() + +# check partition +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [2]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [24]) +model.testResultsVolumes(Partition_1, [61517.614401630766224116086959839]) + +# update extrusion and check partition +Param_ExtrusionMin.setValue(-5) +Param_ExtrusionMax.setValue(15) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [2]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [24]) +model.testResultsVolumes(Partition_1, [60866.055096277588745579123497009]) + +# change radius of a circle and check partition +Param_Radius.setValue(50) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [2]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [24]) +model.testResultsVolumes(Partition_1, [83526.053426235652295872569084167]) + +# check naming +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) + +model.end() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace4.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace4.py new file mode 100644 index 000000000..fd2d4ab24 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace4.py @@ -0,0 +1,82 @@ +## 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 +from GeomAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0") +Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10") +Param_Radius = model.addParameter(Part_1_doc, "Radius", "40") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) +SketchCircle_2 = Sketch_1.addCircle(55, 30, 40) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin") +Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) +SketchArc_1 = Sketch_2.addArc(10.01336797518561, 24.95055816041118, 7.898114670281987, -23.85096600991564, 58.22303946797933, 32.81761798074749, False) +SketchArc_1.result().setColor(225, 0, 0) +SketchArc_1.results()[1].setColor(225, 0, 0) +SketchLine_1 = Sketch_2.addLine(58.22303949051827, 32.8176179844255, 7.898114670281987, -23.85096600991564) +SketchLine_1.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) +model.do() +Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), 90, 0) +Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_2")]) +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "Face_1_1")]) +model.do() + +# check partition +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [2]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [27]) +model.testResultsVolumes(Partition_1, [61887.558125601033680140972137451]) + +# update extrusion and check partition +Param_ExtrusionMin.setValue(-5) +Param_ExtrusionMax.setValue(15) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [2]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [25]) +model.testResultsVolumes(Partition_1, [60989.714891709969379007816314697]) + +# change radius of a circle and check partition +Param_Radius.setValue(50) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [2]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [25]) +model.testResultsVolumes(Partition_1, [83670.313521821837639436125755310]) + +# check naming +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) + +model.end() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace5.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace5.py new file mode 100644 index 000000000..fd3539cac --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace5.py @@ -0,0 +1,82 @@ +## 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 +from GeomAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0") +Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10") +Param_Radius = model.addParameter(Part_1_doc, "Radius", "40") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) +SketchCircle_2 = Sketch_1.addCircle(55, 30, 40) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin") +Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) +SketchArc_1 = Sketch_2.addArc(10.01336797518561, 24.95055816041118, 7.898114670281987, -23.85096600991564, 58.22303946797933, 32.81761798074749, False) +SketchArc_1.result().setColor(225, 0, 0) +SketchArc_1.results()[1].setColor(225, 0, 0) +SketchLine_1 = Sketch_2.addLine(58.22303949051827, 32.8176179844255, 7.898114670281987, -23.85096600991564) +SketchLine_1.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint()) +model.do() +Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), 90, 0) +Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_2")]) +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Extrusion_1_1_3")]) +model.do() + +# check partition +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [2]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [29]) +model.testResultsVolumes(Partition_1, [61804.7209520386313670314848423]) + +# update extrusion and check partition +Param_ExtrusionMin.setValue(-5) +Param_ExtrusionMax.setValue(15) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [2]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [25]) +model.testResultsVolumes(Partition_1, [60965.634801387262996286153793335]) + +# change radius of a circle and check partition +Param_Radius.setValue(50) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [2]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [25]) +model.testResultsVolumes(Partition_1, [83661.21013607898203190416097641]) + +# check naming +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) + +model.end() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane1.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane1.py new file mode 100644 index 000000000..3e12bd028 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane1.py @@ -0,0 +1,71 @@ +## 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 +from GeomAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0") +Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10") +Param_Radius = model.addParameter(Part_1_doc, "Radius", "40") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) +SketchCircle_2 = Sketch_1.addCircle(55, 30, 40) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin") +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("FACE", "PartSet/XOZ")]) +model.do() + +# check partition +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [23]) +model.testResultsVolumes(Partition_1, [58449.978432346062618307769298553]) + +# update extrusion and check partition +Param_ExtrusionMin.setValue(-5) +Param_ExtrusionMax.setValue(15) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [23]) +model.testResultsVolumes(Partition_1, [58449.978432346062618307769298553]) + +# change radius of a circle and check partition +Param_Radius.setValue(50) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [23]) +model.testResultsVolumes(Partition_1, [81554.943249273565015755593776703]) + +# check naming +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) + +model.end() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane2.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane2.py new file mode 100644 index 000000000..f64b01b7e --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane2.py @@ -0,0 +1,71 @@ +## 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 +from GeomAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0") +Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10") +Param_Radius = model.addParameter(Part_1_doc, "Radius", "40") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) +SketchCircle_2 = Sketch_1.addCircle(55, 30, 40) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin") +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("FACE", "PartSet/XOZ")]) +model.do() + +# check partition +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [22]) +model.testResultsVolumes(Partition_1, [58449.978432346062618307769298553]) + +# update extrusion and check partition +Param_ExtrusionMin.setValue(-5) +Param_ExtrusionMax.setValue(15) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [22]) +model.testResultsVolumes(Partition_1, [58449.978432346062618307769298553]) + +# change radius of a circle and check partition +Param_Radius.setValue(50) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [29]) +model.testResultsVolumes(Partition_1, [81554.943249273565015755593776703]) + +# check naming +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) + +model.end() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane3.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane3.py new file mode 100644 index 000000000..befdd8803 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane3.py @@ -0,0 +1,72 @@ +## 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 +from GeomAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0") +Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10") +Param_Radius = model.addParameter(Part_1_doc, "Radius", "40") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) +SketchCircle_2 = Sketch_1.addCircle(55, 30, 40) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin") +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "PartSet/XOZ")]) +model.do() + +# check partition +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [22]) +model.testResultsVolumes(Partition_1, [58449.978432346062618307769298553]) + +# change radius of a circle and check partition +Param_Radius.setValue(50) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [3]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [3]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [15]) +model.testResultsVolumes(Partition_1, [81554.943249273565015755593776703]) + +# update extrusion and check partition +Param_Radius.setValue(40) +Param_ExtrusionMin.setValue(-5) +Param_ExtrusionMax.setValue(15) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [4]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [22]) +model.testResultsVolumes(Partition_1, [58449.978432346062618307769298553]) + +# check naming +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) + +model.end() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane4.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane4.py new file mode 100644 index 000000000..a4e738ff3 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane4.py @@ -0,0 +1,71 @@ +## 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 +from GeomAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0") +Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10") +Param_Radius = model.addParameter(Part_1_doc, "Radius", "40") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) +SketchCircle_2 = Sketch_1.addCircle(55, 30, 40) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin") +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("FACE", "PartSet/XOZ")]) +model.do() + +# check partition +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [28]) +model.testResultsVolumes(Partition_1, [58449.978432021540356799960136414]) + +# update extrusion and check partition +Param_ExtrusionMin.setValue(-5) +Param_ExtrusionMax.setValue(15) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [28]) +model.testResultsVolumes(Partition_1, [58449.978432021540356799960136414]) + +# change radius of a circle and check partition +Param_Radius.setValue(50) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [33]) +model.testResultsVolumes(Partition_1, [81554.943249122647102922201156616]) + +# check naming +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) + +model.end() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane5.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane5.py new file mode 100644 index 000000000..11f2e34c6 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane5.py @@ -0,0 +1,71 @@ +## 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 +from GeomAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0") +Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10") +Param_Radius = model.addParameter(Part_1_doc, "Radius", "40") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) +SketchCircle_2 = Sketch_1.addCircle(55, 30, 40) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin") +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "PartSet/XOZ")]) +model.do() + +# check partition +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [29]) +model.testResultsVolumes(Partition_1, [58449.978432434749265667051076889]) + +# update extrusion and check partition +Param_ExtrusionMin.setValue(-5) +Param_ExtrusionMax.setValue(15) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [29]) +model.testResultsVolumes(Partition_1, [58449.978432434749265667051076889]) + +# change radius of a circle and check partition +Param_Radius.setValue(50) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [29]) +model.testResultsVolumes(Partition_1, [81554.943249120755353942513465881]) + +# check naming +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) + +model.end() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid1.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid1.py new file mode 100644 index 000000000..02f669053 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid1.py @@ -0,0 +1,83 @@ +## 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 +from GeomAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Param_BoxH = model.addParameter(Part_1_doc, "BoxHeight", "10") +Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0") +Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10") +Param_Radius = model.addParameter(Part_1_doc, "Radius", "40") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) +SketchCircle_2 = Sketch_1.addCircle(55, 30, 40) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin") +Box_1 = model.addBox(Part_1_doc, 50, 100, "BoxHeight") +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Box_1_1")]) +model.do() + +# check partition +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [31]) +model.testResultsVolumes(Partition_1, [88456.153365924168610945343971252]) + +# change box height and check partition +Param_BoxH.setValue(20) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [36]) +model.testResultsVolumes(Partition_1, [138456.153365848527755588293075562]) + +# update extrusion and check partition +Param_ExtrusionMin.setValue(-5) +Param_ExtrusionMax.setValue(15) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [5]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [41]) +model.testResultsVolumes(Partition_1, [138456.153365793754346668720245361]) + +# change radius of a circle and check partition +Param_Radius.setValue(50) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [42]) +model.testResultsVolumes(Partition_1, [151872.052359062305185943841934204]) + +# check naming +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) + +model.end() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid2.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid2.py new file mode 100644 index 000000000..d132dd368 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid2.py @@ -0,0 +1,83 @@ +## 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 +from GeomAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Param_BoxH = model.addParameter(Part_1_doc, "BoxHeight", "10") +Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0") +Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10") +Param_Radius = model.addParameter(Part_1_doc, "Radius", "40") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) +SketchCircle_2 = Sketch_1.addCircle(55, 30, 40) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin") +Box_1 = model.addBox(Part_1_doc, 50, 100, "BoxHeight") +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Box_1_1")]) +model.do() + +# check partition +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [39]) +model.testResultsVolumes(Partition_1, [88456.153365924168610945343971252]) + +# change box height and check partition +Param_BoxH.setValue(20) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [43]) +model.testResultsVolumes(Partition_1, [138456.153365848527755588293075562]) + +# update extrusion and check partition +Param_ExtrusionMin.setValue(-5) +Param_ExtrusionMax.setValue(15) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [47]) +model.testResultsVolumes(Partition_1, [138456.153365848527755588293075562]) + +# change radius of a circle and check partition +Param_Radius.setValue(50) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [7]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [7]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [46]) +model.testResultsVolumes(Partition_1, [151872.052359062305185943841934204]) + +# check naming +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) + +model.end() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid3.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid3.py new file mode 100644 index 000000000..736e688e0 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid3.py @@ -0,0 +1,83 @@ +## 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 +from GeomAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Param_BoxH = model.addParameter(Part_1_doc, "BoxHeight", "10") +Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0") +Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10") +Param_Radius = model.addParameter(Part_1_doc, "Radius", "40") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) +SketchCircle_2 = Sketch_1.addCircle(55, 30, 40) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin") +Box_1 = model.addBox(Part_1_doc, 50, 100, "BoxHeight") +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("SOLID", "Box_1_1")]) +model.do() + +# check partition +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [37]) +model.testResultsVolumes(Partition_1, [88456.153365924168610945343971252]) + +# change box height and check partition +Param_BoxH.setValue(20) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [41]) +model.testResultsVolumes(Partition_1, [138456.153365848527755588293075562]) + +# update extrusion and check partition +Param_ExtrusionMin.setValue(-5) +Param_ExtrusionMax.setValue(15) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [45]) +model.testResultsVolumes(Partition_1, [138456.153365848527755588293075562]) + +# change radius of a circle and check partition +Param_Radius.setValue(50) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [42]) +model.testResultsVolumes(Partition_1, [151872.052359062305185943841934204]) + +# check naming +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) + +model.end() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid4.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid4.py new file mode 100644 index 000000000..fef86e870 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid4.py @@ -0,0 +1,83 @@ +## 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 +from GeomAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Param_BoxH = model.addParameter(Part_1_doc, "BoxHeight", "10") +Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0") +Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10") +Param_Radius = model.addParameter(Part_1_doc, "Radius", "40") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) +SketchCircle_2 = Sketch_1.addCircle(55, 30, 40) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin") +Box_1 = model.addBox(Part_1_doc, 50, 100, "BoxHeight") +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Extrusion_1_1_1")]) +model.do() + +# check partition +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [39]) +model.testResultsVolumes(Partition_1, [88456.153365924168610945343971252]) + +# change box height and check partition +Param_BoxH.setValue(20) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [43]) +model.testResultsVolumes(Partition_1, [138456.153365848527755588293075562]) + +# update extrusion and check partition +Param_ExtrusionMin.setValue(-5) +Param_ExtrusionMax.setValue(15) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [47]) +model.testResultsVolumes(Partition_1, [138456.153365848527755588293075562]) + +# change radius of a circle and check partition +Param_Radius.setValue(50) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [7]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [7]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [46]) +model.testResultsVolumes(Partition_1, [151872.052359062305185943841934204]) + +# check naming +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) + +model.end() diff --git a/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid5.py b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid5.py new file mode 100644 index 000000000..9ecd4ed69 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid5.py @@ -0,0 +1,83 @@ +## 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 +from GeomAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Param_BoxH = model.addParameter(Part_1_doc, "BoxHeight", "10") +Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0") +Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10") +Param_Radius = model.addParameter(Part_1_doc, "Radius", "40") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(47, -3, 25) +SketchCircle_2 = Sketch_1.addCircle(55, 30, 40) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin") +Box_1 = model.addBox(Part_1_doc, 50, 100, "BoxHeight") +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2")]) +model.do() + +# check partition +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [39]) +model.testResultsVolumes(Partition_1, [88456.153365924168610945343971252]) + +# change box height and check partition +Param_BoxH.setValue(20) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [43]) +model.testResultsVolumes(Partition_1, [138456.153365848527755588293075562]) + +# update extrusion and check partition +Param_ExtrusionMin.setValue(-5) +Param_ExtrusionMax.setValue(15) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [6]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [47]) +model.testResultsVolumes(Partition_1, [138456.153365848527755588293075562]) + +# change radius of a circle and check partition +Param_Radius.setValue(50) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [7]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [7]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [46]) +model.testResultsVolumes(Partition_1, [151872.052359062305185943841934204]) + +# check naming +model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc) + +model.end() -- 2.30.2