X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesAPI%2FFeaturesAPI_RemoveSubShapes.cpp;h=784869fdb57abff897fb4408c3c47bed6864e044;hb=f60dc9dd94d5d4b0ea07e3e3cbfd5b3028f0942d;hp=24447bc00ecb24490d2467f47f47c9eec66e0e84;hpb=a94fc319f2aa64b43c9a73b5ff7063923648faec;p=modules%2Fshaper.git diff --git a/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.cpp b/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.cpp index 24447bc00..784869fdb 100644 --- a/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.cpp +++ b/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.cpp @@ -62,7 +62,20 @@ void FeaturesAPI_RemoveSubShapes::setBase(const ModelHighAPI_Selection& theBase) void FeaturesAPI_RemoveSubShapes::setSubShapesToKeep( const std::list& theSubShapes) { - fillAttribute(theSubShapes, mysubshapes); + fillAttribute(FeaturesPlugin_RemoveSubShapes::CREATION_METHOD_BY_KEEP_SUBSHAPES(), + mycreationMethod); + fillAttribute(theSubShapes, mysubshapesToKeep); + + execute(); +} + +//================================================================================================== +void FeaturesAPI_RemoveSubShapes::setSubShapesToRemove( + const std::list& theSubShapes) +{ + fillAttribute(FeaturesPlugin_RemoveSubShapes::CREATION_METHOD_BY_REMOVE_SUBSHAPES(), + mycreationMethod); + fillAttribute(theSubShapes, mysubshapesToRemove); execute(); } @@ -75,12 +88,29 @@ void FeaturesAPI_RemoveSubShapes::dump(ModelHighAPI_Dumper& theDumper) const AttributeSelectionPtr anAttrBaseShape = aBase->selection(FeaturesPlugin_RemoveSubShapes::BASE_SHAPE_ID()); - AttributeSelectionListPtr anAttrSubShapes = - aBase->selectionList(FeaturesPlugin_RemoveSubShapes::SUBSHAPES_ID()); - theDumper << aBase << " = model.addRemoveSubShapes(" << aDocName << - ", " << anAttrBaseShape << ")" << std::endl; - theDumper << aBase << ".setSubShapesToKeep(" << anAttrSubShapes << ")" << std::endl; + std::string aCreationMethod = + aBase->string(FeaturesPlugin_RemoveSubShapes::CREATION_METHOD())->value(); + + AttributeSelectionListPtr anAttrSubShapes; + + bool isKeepSubs = + aCreationMethod == FeaturesPlugin_RemoveSubShapes::CREATION_METHOD_BY_KEEP_SUBSHAPES(); + if (isKeepSubs) { + anAttrSubShapes = + aBase->selectionList(FeaturesPlugin_RemoveSubShapes::SUBSHAPES_TO_KEEP_ID()); + } + else { + anAttrSubShapes = + aBase->selectionList(FeaturesPlugin_RemoveSubShapes::SUBSHAPES_TO_REMOVE_ID()); + } + + theDumper << aBase << " = model.addRemoveSubShapes(" + << aDocName << ", " << anAttrBaseShape << ")" + << "\n" + << theDumper.name(aBase) + << (isKeepSubs ? ".setSubShapesToKeep(" : ".setSubShapesToRemove(") + << anAttrSubShapes << ")" << std::endl; } //==================================================================================================