FeaturesAPI_Pipe.h
FeaturesAPI_Placement.h
FeaturesAPI_Recover.h
+ FeaturesAPI_RemoveResults.h
FeaturesAPI_RemoveSubShapes.h
FeaturesAPI_Revolution.h
FeaturesAPI_RevolutionBoolean.h
FeaturesAPI_Pipe.cpp
FeaturesAPI_Placement.cpp
FeaturesAPI_Recover.cpp
+ FeaturesAPI_RemoveResults.cpp
FeaturesAPI_RemoveSubShapes.cpp
FeaturesAPI_Revolution.cpp
FeaturesAPI_RevolutionBoolean.cpp
%shared_ptr(FeaturesAPI_Translation)
%shared_ptr(FeaturesAPI_Union)
%shared_ptr(FeaturesAPI_FusionFaces)
+%shared_ptr(FeaturesAPI_RemoveResults)
// all supported interfaces
%include "FeaturesAPI_BooleanCut.h"
%include "FeaturesAPI_Translation.h"
%include "FeaturesAPI_Union.h"
%include "FeaturesAPI_FusionFaces.h"
+%include "FeaturesAPI_RemoveResults.h"
--- /dev/null
+// Copyright (C) 2014-2019 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
+//
+
+#include "FeaturesAPI_RemoveResults.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Tools.h>
+
+
+//==================================================================================================
+FeaturesAPI_RemoveResults::FeaturesAPI_RemoveResults(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature)
+ : ModelHighAPI_Interface(theFeature)
+{}
+
+//==================================================================================================
+FeaturesAPI_RemoveResults::FeaturesAPI_RemoveResults(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theResults)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setRemoved(theResults);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_RemoveResults::~FeaturesAPI_RemoveResults()
+{}
+
+//==================================================================================================
+void FeaturesAPI_RemoveResults::setRemoved(
+ const std::list<ModelHighAPI_Selection>& theResults)
+{
+ fillAttribute(theResults, myremoved);
+}
+
+//==================================================================================================
+void FeaturesAPI_RemoveResults::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+ const std::string& aDocName = theDumper.name(aBase->document());
+
+ AttributeSelectionListPtr anAttrResults =
+ aBase->selectionList(FeaturesPlugin_RemoveResults::RESULTS_ID());
+
+ theDumper << aBase << " = model.addRemoveResults("
+ << aDocName << ", " << anAttrResults << ")" << std::endl;
+}
+
+//==================================================================================================
+RemoveResultsPtr addRemoveResults(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theResults)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ thePart->addFeature(FeaturesAPI_RemoveResults::ID());
+ return RemoveResultsPtr(new FeaturesAPI_RemoveResults(aFeature, theResults));
+}
--- /dev/null
+// Copyright (C) 2014-2019 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
+//
+
+#ifndef FeaturesAPI_RemoveResults_H_
+#define FeaturesAPI_RemoveResults_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_RemoveResults.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Dumper;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_RemoveResults
+/// \ingroup CPPHighAPI
+/// \brief Interface for RemoveResults feature.
+class FeaturesAPI_RemoveResults: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_RemoveResults(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_RemoveResults(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theResults);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_RemoveResults();
+
+ INTERFACE_1(FeaturesPlugin_RemoveResults::ID(),
+ removed, FeaturesPlugin_RemoveResults::RESULTS_ID(),
+ ModelAPI_AttributeSelectionList, /** Results to remove */)
+
+ /// Modify removed results arguments.
+ FEATURESAPI_EXPORT
+ void setRemoved(const std::list<ModelHighAPI_Selection>& theResults);
+
+ /// Dump wrapped feature
+ FEATURESAPI_EXPORT
+ virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on RemoveResults object.
+typedef std::shared_ptr<FeaturesAPI_RemoveResults> RemoveResultsPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create RemoveResults feature.
+FEATURESAPI_EXPORT
+RemoveResultsPtr addRemoveResults(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theResults);
+
+#endif // FeaturesAPI_RemoveResults_H_
#include "FeaturesAPI_Translation.h"
#include "FeaturesAPI_Union.h"
#include "FeaturesAPI_FusionFaces.h"
+ #include "FeaturesAPI_RemoveResults.h"
#endif // FeaturesAPI_swig_H_
FeaturesPlugin_Fillet.h
FeaturesPlugin_Measurement.h
FeaturesPlugin_FusionFaces.h
+ FeaturesPlugin_RemoveResults.h
)
SET(PROJECT_SOURCES
FeaturesPlugin_Fillet.cpp
FeaturesPlugin_Measurement.cpp
FeaturesPlugin_FusionFaces.cpp
+ FeaturesPlugin_RemoveResults.cpp
)
SET(XML_RESOURCES
TestUnion_MultiLevelCompound_v0.py
TestUnion_MultiLevelCompound_v20190506.py
TestUnionFaces_v20190506.py
+ TestRemoveResultsBody.py
+ TestRemoveResultsConstruction.py
+ TestRemoveResultsPart.py
)
#include <FeaturesPlugin_Translation.h>
#include <FeaturesPlugin_Union.h>
#include <FeaturesPlugin_FusionFaces.h>
+#include <FeaturesPlugin_RemoveResults.h>
#include <FeaturesPlugin_ValidatorTransform.h>
#include <FeaturesPlugin_Validators.h>
return FeaturePtr(new FeaturesPlugin_Fillet);
} else if (theFeatureID == FeaturesPlugin_Measurement::ID()) {
return FeaturePtr(new FeaturesPlugin_Measurement);
+ } else if (theFeatureID == FeaturesPlugin_RemoveResults::ID()) {
+ return FeaturePtr(new FeaturesPlugin_RemoveResults);
}
// feature of such kind is not found
--- /dev/null
+// Copyright (C) 2014-2019 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
+//
+
+#include "FeaturesPlugin_RemoveResults.h"
+
+#include <ModelAPI_AttributeSelectionList.h>
+
+//==================================================================================================
+FeaturesPlugin_RemoveResults::FeaturesPlugin_RemoveResults()
+{
+}
+
+//==================================================================================================
+void FeaturesPlugin_RemoveResults::initAttributes()
+{
+ data()->addAttribute(RESULTS_ID(), ModelAPI_AttributeSelectionList::typeId());
+}
--- /dev/null
+// Copyright (C) 2014-2019 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
+//
+
+#ifndef FeaturesPlugin_RemoveResults_H_
+#define FeaturesPlugin_RemoveResults_H_
+
+#include "FeaturesPlugin.h"
+
+#include <ModelAPI_Feature.h>
+
+/// \class FeaturesPlugin_RemoveResults
+/// \ingroup Plugins
+/// \brief AN internal, hidden feature for results removal.
+class FeaturesPlugin_RemoveResults : public ModelAPI_Feature
+{
+public:
+ /// Use plugin manager for features creation
+ FeaturesPlugin_RemoveResults();
+
+ /// Feature kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_ID("RemoveResults");
+ return MY_ID;
+ }
+
+ /// Attribute name of removed shapes selector.
+ inline static const std::string& RESULTS_ID()
+ {
+ static const std::string MY_BASE_SHAPE_ID("results");
+ return MY_BASE_SHAPE_ID;
+ }
+
+ /// \return the kind of a feature.
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_RemoveResults::ID();
+ return MY_KIND;
+ }
+
+ /// Request for initialization of data model of the feature: adding all attributes.
+ FEATURESPLUGIN_EXPORT virtual void initAttributes();
+
+ /// Does nothing, has no results.
+ FEATURESPLUGIN_EXPORT virtual void execute() {}
+
+ /// Hidden from the user.
+ FEATURESPLUGIN_EXPORT virtual bool isInHistory() {return false;}
+};
+
+#endif
--- /dev/null
+# Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 2)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
+RemoveResults_1 = model.addRemoveResults(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")])
+model.end()
+
+# check the number of bodies = 0, number of construction = 1
+from ModelAPI import *
+assert(Part_1.document().size(ModelAPI_ResultConstruction.group()) == 1)
+assert(Part_1.document().size(ModelAPI_ResultBody.group()) == 0)
+
+assert(model.checkPythonDump())
--- /dev/null
+# Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 2)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
+RemoveResults_1 = model.addRemoveResults(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")])
+model.end()
+
+# check the number of bodies = 1, number of construction = 0
+from ModelAPI import *
+assert(Part_1.document().size(ModelAPI_ResultConstruction.group()) == 0)
+assert(Part_1.document().size(ModelAPI_ResultBody.group()) == 1)
+
+assert(model.checkPythonDump())
--- /dev/null
+# Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.do()
+RemoveResults_1 = model.addRemoveResults(partSet, [model.selection("SHAPE", "Part_1/")])
+model.end()
+
+# check the number of parts = 0
+from ModelAPI import *
+assert(Part_1.document().size(ModelAPI_ResultPart.group()) == 0)
helpfile="recoverFeature.html">
<source path="recover_widget.xml"/>
</feature>
+ <feature id="RemoveResults" title="Remove results" tooltip="Internal feature for results removal" internal="1">
+ <multi_selector id="results" concealment="true"/>
+ </feature>
</group>
<group id="Fillet">
<feature id="Fillet" title="Fillet" tooltip="Perform fillet on face or edge"
std::shared_ptr<GeomAPI_Shape> aResult;
if (myRef.isInitialized()) {
TDF_Label aSelLab = selectionLabel();
- if (aSelLab.IsAttribute(kSIMPLE_REF_ID)) { // it is just reference to shape, not sub-shape
+ // it is just reference to shape, not sub-shape
+ if (aSelLab.IsAttribute(kSIMPLE_REF_ID) || aSelLab.IsAttribute(kPART_REF_ID)) {
ResultPtr aContext = context();
return aContext.get() != NULL;
}
#include <ModelAPI_Feature.h>
#include <ModelAPI_Result.h>
#include <ModelAPI_ResultParameter.h>
+#include <ModelAPI_ResultConstruction.h>
#include <ModelAPI_Validator.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_ResultPart.h>
// be displayed and previewed; also for avoiding of quick show/hide on history
// moving deep down
if (aRes && !theFeature->isDisabled()) {
- aRes->setIsConcealed(true);
+ aRes->setIsConcealed(true, theFeature->getKind() == "RemoveResults");
}
}
}
std::shared_ptr<ModelAPI_Result> aRes =
std::dynamic_pointer_cast<ModelAPI_Result>(myObject);
if (aRes.get()) {
- aRes->setIsConcealed(true); // set concealed
- return;
+ if (aRes->groupName() != ModelAPI_ResultConstruction::group()) {
+ aRes->setIsConcealed(true); // set concealed
+ return;
+ } else if (aFeature->getKind() == "RemoveResults") {
+ aRes->setIsConcealed(true, true);
+ return;
+ }
}
}
}
}
}
}
+ if (theVisible) { // make RemoveResults feature be active even it is performed after the current
+ int anIndex = kUNDEFINED_FEATURE_INDEX;
+ FeaturePtr aNext =
+ theCurrent.get() ? myObjs->nextFeature(theCurrent, anIndex, false) : myObjs->firstFeature();
+ for (; aNext.get(); aNext = myObjs->nextFeature(theCurrent, anIndex, false)) {
+ if (aNext->isInHistory()) {
+ break; // next in history is not needed
+ } else if (aNext->getKind() == "RemoveResults"){
+ theCurrent = aNext;
+ }
+ }
+ }
if (theCurrent.get()) {
std::shared_ptr<Model_Data> aData = std::static_pointer_cast<Model_Data>(theCurrent->data());
if (!aData.get() || !aData->isValid()) {
return myLastConcealed;
}
-void Model_ResultBody::setIsConcealed(const bool theValue)
+void Model_ResultBody::setIsConcealed(const bool theValue, const bool theForced)
{
if (ModelAPI_ResultBody::isConcealed() != theValue) {
- ModelAPI_ResultBody::setIsConcealed(theValue);
+ ModelAPI_ResultBody::setIsConcealed(theValue, theForced);
updateConcealment();
}
}
MODEL_EXPORT virtual bool isConcealed();
/// Sets all subs as concealed in the data tree (referenced by other objects)
- MODEL_EXPORT virtual void setIsConcealed(const bool theValue);
+ MODEL_EXPORT virtual void setIsConcealed(const bool theValue, const bool theForced = false);
/// Returns true is the topology is connected.
MODEL_EXPORT virtual bool isConnectedTopology();
return aResult;
}
-void Model_ResultConstruction::setIsConcealed(const bool theValue)
+void Model_ResultConstruction::setIsConcealed(const bool theValue, const bool theForced)
{
- // do nothing: the construction element is never concealed
+ // the construction element may be concealed only by "delete" feature
+ if (!theValue || theForced) {
+ ModelAPI_ResultConstruction::setIsConcealed(theValue, theForced);
+ }
}
void Model_ResultConstruction::storeShape(std::shared_ptr<GeomAPI_Shape> theShape)
MODEL_EXPORT virtual bool isInfinite();
/// Sets the flag that it is infinite
MODEL_EXPORT virtual void setInfinite(const bool theInfinite);
- /// The construction element is never concealed
- MODEL_EXPORT virtual void setIsConcealed(const bool theValue);
+ /// The construction element may be concealed only by "delete" feature
+ MODEL_EXPORT virtual void setIsConcealed(const bool theValue, const bool theForced = false);
/// Updates the shape taking the current value from the data structure, returns true
/// if update has been correctly done
return myIsConcealed;
}
-void ModelAPI_Result::setIsConcealed(const bool theValue)
+void ModelAPI_Result::setIsConcealed(const bool theValue, const bool theForced)
{
if (myIsConcealed != theValue) {
myIsConcealed = theValue;
MODELAPI_EXPORT virtual bool isConcealed();
/// Sets the result as concealed in the data tree (referenced by other objects)
- MODELAPI_EXPORT virtual void setIsConcealed(const bool theValue);
+ MODELAPI_EXPORT virtual void setIsConcealed(const bool theValue, const bool theForced = false);
/// Enables/disables the result. The disabled result does not participate in any calculation
/// and visualization: like it was removed. But it keeps the general parameters: colors,
#include <ModelAPI_Document.h>
#include <ModelAPI_Object.h>
#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_ResultParameter.h>
#include <ModelAPI_ResultPart.h>
return aParents;
}
+void removeResults(const std::list<ResultPtr>& theResults)
+{
+ // collect all documents where the results must be removed
+ std::map<DocumentPtr, std::list<ResultPtr> > aDocs;
+
+ std::list<ResultPtr>::const_iterator aResIter = theResults.cbegin();
+ for(; aResIter != theResults.cend(); aResIter++) {
+ DocumentPtr aDoc = (*aResIter)->document();
+ if (!aDocs.count(aDoc))
+ aDocs[aDoc] = std::list<ResultPtr>();
+ aDocs[aDoc].push_back(*aResIter);
+ }
+ // create a "remove" feature in each doc
+ std::map<DocumentPtr, std::list<ResultPtr> >::iterator aDoc = aDocs.begin();
+ for(; aDoc != aDocs.end(); aDoc++) {
+ FeaturePtr aRemove = aDoc->first->addFeature("RemoveResults");
+ if (aRemove) {
+ for(aResIter = aDoc->second.cbegin(); aResIter != aDoc->second.cend(); aResIter++)
+ aRemove->selectionList("results")->append(*aResIter, GeomShapePtr());
+ }
+ }
+}
+
} // namespace ModelAPI_Tools
*/
MODELAPI_EXPORT std::set<std::shared_ptr<ModelAPI_Feature> >
getParents(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+/*! Creates a remove result features with the given results
+*/
+MODELAPI_EXPORT void removeResults(const std::list<std::shared_ptr<ModelAPI_Result> >& theResults);
}
#endif
aLast = theReferencesToDelete.end();
for (; anIt != aLast; anIt++) {
FeaturePtr aFeature = *anIt;
+ if (aFeature->getKind() == "RemoveResults")
+ continue; // skip the remove results feature mentioning: result will be removed anyway
if (isFeatureOfResult(aFeature, ModelAPI_ResultPart::group()))
aPartFeatureNames.append(aFeature->name().c_str());
else
/// Sets or removes the shadow effect to the widget
/// \param theWidget a widget to be styled
-/// \param isSetEffect if true, the shadow effect is set, overwise cleared
+/// \param isSetEffect if true, the shadow effect is set, otherwise cleared
/// \return resulting pixmap
MODULEBASE_EXPORT void setShadowEffect(QWidget* theWidget, const bool isSetEffect);
/// Sets the default coeffient into the driver calculated accordingly the shape type.
/// It provides 1.e-4 for results of construction type
-/// \param theResult a result object to define the deviation coeffient
+/// \param theResult a result object to define the deviation coefficient
/// \param theDrawer a drawer
//MODULEBASE_EXPORT void setDefaultDeviationCoefficient(
// const std::shared_ptr<ModelAPI_Result>& theResult,
/// Sets the default coeffient into the driver calculated accordingly the shape type.
/// It provides 1.e-4 for a shape withe Edge shape type
-/// \param theShape a shape to define the deviation coeffient,
+/// \param theShape a shape to define the deviation coefficient,
/// \param theDrawer a drawer
MODULEBASE_EXPORT void setDefaultDeviationCoefficient(const TopoDS_Shape& theShape,
const Handle(Prs3d_Drawer)& theDrawer);
/// Returns true if the object if a sub child of the feature. The feature is casted to the
-/// composite one. If it is possible, the sub object check happens. The method is applyed
+/// composite one. If it is possible, the sub object check happens. The method is applied
/// recursively to the feature subs.
/// \param theObject a candidate to be a sub object
/// \param theFeature a candidate to be a composite feature
std::set<FeaturePtr>& theReferencesToDelete,
const std::string& thePrefixInfo = "");
-/// Converts a list of objects to set of corresponded features. If object is result, it is ingored
-/// because the feauture only might be removed. But if result is in a parameter group, the feature
+/// Converts a list of objects to set of corresponded features. If object is result, it is ignored
+/// because the feature only might be removed. But if result is in a parameter group, the feature
/// of this parameter is to be removed
/// \param theObjects a list of objects
-/// \param theFeatures an out conteiner of features
+/// \param theFeatures an out container of features
void MODULEBASE_EXPORT convertToFeatures(const QObjectPtrList& theObjects,
std::set<FeaturePtr>& theFeatures);
/// Converts a list of objects to set of folders.
/// \param theObjects a list of objects
-/// \param theFeatures an out conteiner of features
+/// \param theFeatures an out container of features
void MODULEBASE_EXPORT convertToFolders(const QObjectPtrList& theObjects,
std::set<FolderPtr>& theFolders);
/// Returns translation from the given data.
/// If translation is not exists then it returns a string
/// from the info data without translation
-/// \param theMessage a message which dave to be translated
+/// \param theMessage a message which have to be translated
QString MODULEBASE_EXPORT translate(const Events_InfoMessage& theMessage);
/// Returns translation from the given data.
/// If translation is not exists then it returns a string
/// from the info data without translation
/// \param theContext context of the message (Feature Id)
-/// \param theMessage a message which dave to be translated
+/// \param theMessage a message which have to be translated
QString MODULEBASE_EXPORT translate(const std::string& theContext, const std::string& theMessage);
/// Set Highlighting of points as a Ball shape
aFeatureKind = theFeature.getKind()
if aFeatureKind in self.myFeatures:
# Dump only feature created by user (in history).
- # Also dump Export features (hard-coded here in order not to change the data model).
+ # Also dump Export and RemoveResults features (hard-coded here in order not to change the data model).
# For all other features, just keep their name.
- if theForce or theFeature.isInHistory() or aFeatureKind=="Export":
+ if theForce or theFeature.isInHistory() or aFeatureKind=="Export" or aFeatureKind=="RemoveResults":
self.myFeatures[aFeatureKind](theFeature).dump(self)
else:
self.name(theFeature)
return std_string()
# Instance of dumper
-dumper = DumpAssistant
\ No newline at end of file
+dumper = DumpAssistant
from FeaturesAPI import addFillet
from FeaturesAPI import addFusionFaces
from FeaturesAPI import measureLength, measureDistance, measureRadius, measureAngle
+from FeaturesAPI import addRemoveResults
break;
}
if (!hasCompositeOwner && allActive ) {
- if (hasFeature || hasParameter)
+ if (hasResult || hasFeature || hasParameter) // #2924 results can be erased
action("DELETE_CMD")->setEnabled(true);
}
if (!hasCompositeOwner && allActive && (hasFeature|| hasParameter))
aList.append(action("TRANSPARENCY_CMD"));
#endif
aList.append(action("SHOW_FEATURE_CMD"));
+ aList.append(mySeparator2);
+ aList.append(action("DELETE_CMD"));
myObjBrowserMenus[ModelAPI_ResultConstruction::group()] = aList;
//-------------------------------------
aList.append(action("TRANSPARENCY_CMD"));
#endif
aList.append(action("SHOW_FEATURE_CMD"));
+ aList.append(mySeparator3);
+ aList.append(action("DELETE_CMD"));
myObjBrowserMenus[ModelAPI_ResultBody::group()] = aList;
// Group menu
myObjBrowserMenus[ModelAPI_ResultGroup::group()] = aList;
//save current file before close if modified
SessionPtr aSession = ModelAPI_Session::get();
if (aSession->isModified()) {
- //TODO(sbh): re-launch the app?
int anAnswer = QMessageBox::question(
desktop(), tr("Save current file"),
tr("The document is modified, save before opening another?"),
// the property panel is active window of the desktop, when it is
// hidden, it is undefined which window becomes active. By this reason
// it is defined to perform the desktop as the active window.
- // in SALOME mode, workstack made the PyConsole the active window,
+ // in SALOME mode, work-stack made the PyConsole the active window,
// set the focus on it. As a result, shortcuts of the application, like
// are processed by this console. For example Undo actions.
// It is possible that this code is to be moved to SHAPER package
bool hasFolder = false;
ModuleBase_Tools::checkObjects(anObjects, hasResult, hasFeature, hasParameter, hasCompositeOwner,
hasResultInHistory, hasFolder);
- if (!(hasFeature || hasParameter || hasFolder))
+ if (!(hasResult || hasFeature || hasParameter || hasFolder))
return;
// delete objects
}
}
}
+ // remove results selected
+ std::list<ResultPtr> aResults;
+ for(QObjectPtrList::const_iterator anIt = anObjects.begin(); anIt != anObjects.end(); anIt++) {
+ ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(*anIt);
+ if (aRes.get() && aRes->data()->isValid() && !aRes->data()->isDeleted())
+ aResults.push_back(aRes);
+ }
+ if (!aResults.empty()) {
+ ModelAPI_Tools::removeResults(aResults);
+ }
if (aDone)
operationMgr()->commitOperation();
ModelAPI_Tools::findAllReferences(aFeatures, aReferences, true, false);
// find for each object whether all reference values are in the map as key, that means that there
// is no other reference in the model to this object, so it might be removed by cleaning history
- // sk_1(ext_1, vertex_1) + (sk_3, bool_1) - cann't be deleted, dependency to bool_1
- // ext_1(bool_1, sk_3) - cann't be deleted, dependency to bool_1
+ // sk_1(ext_1, vertex_1) + (sk_3, bool_1) - can't be deleted, dependency to bool_1
+ // ext_1(bool_1, sk_3) - can't be deleted, dependency to bool_1
// vertex_1()
- // sk_2(ext_2) + (bool_1) - cann't be deleted, dependency to bool_1
- // ext_2(bool_1) - cann't be deleted, dependency to bool_1
+ // sk_2(ext_2) + (bool_1) - can't be deleted, dependency to bool_1
+ // ext_2(bool_1) - can't be deleted, dependency to bool_1
// sk_3()
// Information: bool_1 is not selected
std::set<FeaturePtr> anUnusedObjects;