for anIndex in range(0, aFeaturesNum):
aFeature = self.Part.object("Features", anIndex)
aSelectionList = aFeature.data().selectionList("group_list")
- aName = aFeature.data().name()
# if a group has been found
if aSelectionList:
+ aFeature = ModelAPI.objectToFeature(aFeature)
+ if aFeature.firstResult() is not None:
+ aName = aFeature.firstResult().data().name()
groupIndex = groupIndex + 1
self.createGroupFromList(aSelectionList, aName)
void Model_Application::deleteAllDocuments()
{
+ std::map<std::string, std::shared_ptr<Model_Document> >::iterator aDoc = myDocs.begin();
+ for(; aDoc != myDocs.end(); aDoc++) {
+ aDoc->second->close();
+ }
myDocs.clear();
myLoadedByDemand.clear();
}
void onSelectionTypeChanged();
/// Slot is called on selection changed
- void onSelectionChanged();
+ virtual void onSelectionChanged();
protected slots:
/// Slot for copy command in a list pop-up menu
/// Start shape selection
void activateShapeSelection();
- private:
+ protected:
/// Update selection list
void updateSelectionList(AttributeSelectionListPtr);
return aSelectedObject;
}
+//********************************************************************
+ObjectPtr PartSet_ExternalObjectsMgr::externalObjectValidated(const ObjectPtr& theSelectedObject,
+ const GeomShapePtr& theShape,
+ const CompositeFeaturePtr& theSketch)
+{
+ // TODO(nds): unite with externalObject()
+ ObjectPtr aSelectedObject = PartSet_Tools::findFixedObjectByExternal(theShape->impl<TopoDS_Shape>(),
+ theSelectedObject, theSketch);
+ if (!aSelectedObject.get()) {
+ // Processing of external (non-sketch) object
+ aSelectedObject = PartSet_Tools::createFixedObjectByExternal(theShape->impl<TopoDS_Shape>(),
+ theSelectedObject, theSketch);
+ if (aSelectedObject.get())
+ myExternalObjectValidated = aSelectedObject;
+ }
+ return aSelectedObject;
+}
+
//********************************************************************
void PartSet_ExternalObjectsMgr::removeExternal(const CompositeFeaturePtr& theSketch,
const FeaturePtr& theFeature)
XGUI_Workshop::deleteFeatures(anObjects, anIgnoredFeatures);
}
}
+ //removeExternalObject(anObject, theSketch, theFeature);
}
myExternalObjects.clear();
}
+
+//********************************************************************
+void PartSet_ExternalObjectsMgr::removeUnusedExternalObjects(const QObjectPtrList& theIgnoreObjects,
+ const CompositeFeaturePtr& theSketch,
+ const FeaturePtr& theFeature)
+{
+ /*
+ // TODO(nds): unite with removeExternal(), remove parameters
+ QObjectPtrList aUsedExternalObjects;
+
+ QObjectPtrList::const_iterator anIt = myExternalObjects.begin(), aLast = myExternalObjects.end();
+ for (; anIt != aLast; anIt++) {
+ ObjectPtr anObject = *anIt;
+ if (theIgnoreObjects.contains(anObject))
+ aUsedExternalObjects.append(anObject);
+ else
+ removeExternalObject(anObject, theSketch, theFeature);
+ }*/
+ myExternalObjects.clear();
+ //if (!aUsedExternalObjects.empty())
+ // myExternalObjects = aUsedExternalObjects;
+}
+
+//********************************************************************
+void PartSet_ExternalObjectsMgr::removeExternalValidated(const CompositeFeaturePtr& theSketch,
+ const FeaturePtr& theFeature)
+{
+ // TODO(nds): unite with removeExternal(), remove parameters
+ removeExternalObject(myExternalObjectValidated, theSketch, theFeature);
+ myExternalObjectValidated = NULL;
+}
+
+void PartSet_ExternalObjectsMgr::removeExternalObject(const ObjectPtr& theObject,
+ const CompositeFeaturePtr& theSketch,
+ const FeaturePtr& theFeature)
+{
+ if (theObject.get()) {
+ DocumentPtr aDoc = theObject->document();
+ FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
+ if (aFeature.get() != NULL) {
+ QObjectPtrList anObjects;
+ anObjects.append(aFeature);
+ // the external feature should be removed with all references, sketch feature should be ignored
+ std::set<FeaturePtr> anIgnoredFeatures;
+ anIgnoredFeatures.insert(theSketch);
+ // the current feature should be ignored, because it can use the external feature in the
+ // attributes and, therefore have a references to it. So, the delete functionality tries
+ // to delete this feature. Test case is creation of a constraint on external point,
+ // use in this control after an external point, the point of the sketch.
+ anIgnoredFeatures.insert(theFeature);
+ XGUI_Workshop::deleteFeatures(anObjects, anIgnoredFeatures);
+ }
+ }
+}
ObjectPtr externalObject(const ObjectPtr& theSelectedObject, const GeomShapePtr& theShape,
const CompositeFeaturePtr& theSketch);
+ ObjectPtr externalObjectValidated(const ObjectPtr& theSelectedObject, const GeomShapePtr& theShape,
+ const CompositeFeaturePtr& theSketch);
+
+
// Removes the external presentation from the model
/// \param theSketch a current sketch
/// \param theFeature a current feature
void removeExternal(const CompositeFeaturePtr& theSketch,
const FeaturePtr& theFeature);
+ void removeExternalValidated(const CompositeFeaturePtr& theSketch,
+ const FeaturePtr& theFeature);
+
+ void removeUnusedExternalObjects(const QObjectPtrList& theIgnoreObjects,
+ const CompositeFeaturePtr& theSketch,
+ const FeaturePtr& theFeature);
+
+protected:
+ void removeExternalObject(const ObjectPtr& theObject,
+ const CompositeFeaturePtr& theSketch,
+ const FeaturePtr& theFeature);
+
protected:
/// An external object
QObjectPtrList myExternalObjects;
+ /// An external object
+ ObjectPtr myExternalObjectValidated;
+
/// Boolean value about the neccessity of the external object use
bool myUseExternal;
};
#include <ModelAPI_Validator.h>
#include <ModuleBase_Definitions.h>
+#include <ModuleBase_Tools.h>
+#include <ModuleBase_IWorkshop.h>
+#include <ModuleBase_ISelection.h>
+
#include <Config_WidgetAPI.h>
#include <PartSet_Tools.h>
#include <XGUI_Workshop.h>
+#include <QComboBox>
+
PartSet_WidgetMultiSelector::PartSet_WidgetMultiSelector(QWidget* theParent,
ModuleBase_IWorkshop* theWorkshop,
const Config_WidgetAPI* theData,
const std::string& theParentId)
-: ModuleBase_WidgetShapeSelector(theParent, theWorkshop, theData, theParentId)
+: ModuleBase_WidgetMultiSelector(theParent, theWorkshop, theData, theParentId)
{
myExternalObjectMgr = new PartSet_ExternalObjectsMgr(theData->getProperty("use_external"), false);
}
delete myExternalObjectMgr;
}
+//********************************************************************
+void PartSet_WidgetMultiSelector::onSelectionChanged()
+{
+ ModuleBase_WidgetMultiSelector::onSelectionChanged();
+ // TODO(nds): unite with externalObject(), remove parameters
+ //myFeature->execute();
+
+ DataPtr aData = myFeature->data();
+ AttributeSelectionListPtr aSelectionListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aData->attribute(attributeID()));
+
+ QObjectPtrList aListOfAttributeObjects;
+ for (int i = 0; i < aSelectionListAttr->size(); i++) {
+ AttributeSelectionPtr anAttr = aSelectionListAttr->value(i);
+ aListOfAttributeObjects.append(anAttr->context());
+ }
+
+ myExternalObjectMgr->removeUnusedExternalObjects(aListOfAttributeObjects, sketch(), myFeature);
+}
+
+//********************************************************************
+void PartSet_WidgetMultiSelector::storeAttributeValue()
+{
+ myIsInVaildate = true;
+ ModuleBase_WidgetMultiSelector::storeAttributeValue();
+
+}
+
//********************************************************************
void PartSet_WidgetMultiSelector::restoreAttributeValue(const bool theValid)
{
- ModuleBase_WidgetShapeSelector::restoreAttributeValue(theValid);
- myExternalObjectMgr->removeExternal(sketch(), myFeature);
+ myIsInVaildate = false;
+ ModuleBase_WidgetMultiSelector::restoreAttributeValue(theValid);
+
+ myExternalObjectMgr->removeExternalValidated(sketch(), myFeature);
+}
+
+//********************************************************************
+bool PartSet_WidgetMultiSelector::setSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
+{
+ TopoDS_Shape aShape = thePrs.shape();
+ if ((myTypeCombo->count() > 1) && (!aShape.IsNull())) {
+ TopAbs_ShapeEnum aType = ModuleBase_Tools::shapeType(myTypeCombo->currentText());
+ if (aShape.ShapeType() != aType)
+ return false;
+ }
+ ResultPtr aResult;
+ if (!thePrs.owner().IsNull()) {
+ ObjectPtr anObject = myWorkshop->selection()->getSelectableObject(thePrs.owner());
+ aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
+ }
+ else {
+ aResult = std::dynamic_pointer_cast<ModelAPI_Result>(thePrs.object());
+ }
+
+
+ if (myFeature) {
+ // We can not select a result of our feature
+ const std::list<ResultPtr>& aResList = myFeature->results();
+ std::list<ResultPtr>::const_iterator aIt;
+ bool isSkipSelf = false;
+ for (aIt = aResList.cbegin(); aIt != aResList.cend(); ++aIt) {
+ if ((*aIt) == aResult) {
+ isSkipSelf = true;
+ break;
+ }
+ }
+ if(isSkipSelf)
+ return false;
+ }
+
+ GeomShapePtr aGShape = GeomShapePtr();
+ const TopoDS_Shape& aTDSShape = thePrs.shape();
+ // if only result is selected, an empty shape is set to the model
+ if (aTDSShape.IsNull()) {
+ //aSelectionListAttr->append(aResult, GeomShapePtr());
+ }
+ else {
+ aGShape = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
+ //GeomShapePtr aShape(new GeomAPI_Shape());
+ aGShape->setImpl(new TopoDS_Shape(aTDSShape));
+ // We can not select a result of our feature
+ if (aGShape->isEqual(aResult->shape())) {
+ //aSelectionListAttr->append(aResult, GeomShapePtr());
+ aGShape = GeomShapePtr();
+ }
+ else {
+ //aSelectionListAttr->append(aResult, aShape);
+ }
+ }
+
+ setObject(aResult, aGShape);
+ return true;
+}
+
+//********************************************************************
+bool PartSet_WidgetMultiSelector::setObject(const ObjectPtr& theSelectedObject,
+ const GeomShapePtr& theShape)
+{
+ ObjectPtr aSelectedObject = theSelectedObject;
+ GeomShapePtr aShape = theShape;
+
+ FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(aSelectedObject);
+ //if (aSelectedFeature == myFeature) // In order to avoid selection of the same object
+ // return false;
+
+ // Do check using of external feature
+ std::shared_ptr<SketchPlugin_Feature> aSPFeature =
+ std::dynamic_pointer_cast<SketchPlugin_Feature>(aSelectedFeature);
+
+ // Do check that we can use external feature
+ if ((aSPFeature.get() != NULL) && aSPFeature->isExternal() && (!myExternalObjectMgr->useExternal()))
+ return false;
+
+ if (aSPFeature.get() == NULL && aShape.get() != NULL && !aShape->isNull() && myExternalObjectMgr->useExternal()) {
+ if (myIsInVaildate)
+ aSelectedObject = myExternalObjectMgr->externalObjectValidated(theSelectedObject, theShape, sketch());
+ else
+ aSelectedObject = myExternalObjectMgr->externalObject(theSelectedObject, theShape, sketch());
+ }
+
+
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aSelectedObject);
+
+ DataPtr aData = myFeature->data();
+ AttributeSelectionListPtr aSelectionListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aData->attribute(attributeID()));
+
+ aSelectionListAttr->append(aResult, aShape);
+
+ return true;
}
#include "PartSet.h"
-#include <ModuleBase_WidgetShapeSelector.h>
+#include <ModuleBase_WidgetMultiSelector.h>
+#include <ModuleBase_ViewerPrs.h>
#include <ModelAPI_CompositeFeature.h>
/**
* \ingroup Modules
-* Customosation of ModuleBase_WidgetShapeSelector in order to provide
-* working with sketch specific objects.
+* Customosation of ModuleBase_WidgetMultiSelector in order to provide
+* working with sketch specific objects and creation of external objects.
*/
-class PARTSET_EXPORT PartSet_WidgetMultiSelector: public ModuleBase_WidgetShapeSelector
+class PARTSET_EXPORT PartSet_WidgetMultiSelector: public ModuleBase_WidgetMultiSelector
{
Q_OBJECT
public:
/// Retrurns installed sketcher
CompositeFeaturePtr sketch() const { return mySketch; }
+ /// Fills the attribute with the value of the selected owner
+ /// \param theOwner a selected owner
+ virtual bool setSelectionCustom(const ModuleBase_ViewerPrs& thePrs);
+
+public slots:
+ /// Slot is called on selection changed
+ virtual void onSelectionChanged();
+
protected:
+ /// Creates a backup of the current values of the attribute
+ /// It should be realized in the specific widget because of different
+ /// parameters of the current attribute
+ virtual void storeAttributeValue();
+
/// Creates a backup of the current values of the attribute
/// It should be realized in the specific widget because of different
/// parameters of the current attribute
/// \param theValid a boolean flag, if restore happens for valid parameters
void restoreAttributeValue(const bool theValid);
+ /// Store the values to the model attribute of the widget. It casts this attribute to
+ /// the specific type and set the given values
+ /// \param theSelectedObject an object
+ /// \param theShape a selected shape, which is used in the selection attribute
+ /// \return true if it is succeed
+ bool setObject(const ObjectPtr& theSelectedObject, const GeomShapePtr& theShape);
+
protected:
PartSet_ExternalObjectsMgr* myExternalObjectMgr;
/// Pointer to a sketch
CompositeFeaturePtr mySketch;
+
+ bool myIsInVaildate;
};
#endif
\ No newline at end of file
<workbench id="Macros" document="Part">
<group id="Samples">
- <feature id="Box" title="Box" tooltip="Create a box parallel to xyz by extruding a rectangular" icon=":pictures/part_ico.png">
+ <feature id="Box" title="Box" tooltip="Create a box parallel to xyz by extruding a rectangular" icon=":pictures/box_ico.png">
<doublevalue id="width" label="dx: " min="0" step="1.0" default="50" tooltip="Sets the box width">
<validator id="GeomValidators_Positive"/>
</doublevalue>
{
AttributeSelectionListPtr aMirrorObjectRefs =
selectionList(SketchPlugin_ConstraintMirror::MIRROR_LIST_ID());
- if (!aMirrorObjectRefs->isInitialized())
- return;
std::shared_ptr<ModelAPI_Data> aData = data();
AttributeRefListPtr aRefListOfShapes = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(
label="Mirror line" tooltip="Select mirror line" shape_types="edge">
<validator id="GeomValidators_Edge" parameters="line"/>
</sketch_shape_selector>
- <multi_selector id="ConstraintMirrorList"
+ <sketch_multi_selector id="ConstraintMirrorList"
label="List of objects"
tooltip="Select list of mirroring objects"
- type_choice="Edges">
+ type_choice="Edges"
+ use_external="true">
<validator id="SketchPlugin_MirrorAttr" />
- </multi_selector>
+ </sketch_multi_selector>
</feature>
</group>
</workbench>
Slvs_hConstraint SketchSolver_ConstraintCoincidence::addConstraint(
Slvs_hEntity thePoint1, Slvs_hEntity thePoint2)
{
+ bool hasDuplicated = myStorage->hasDuplicatedConstraint();
Slvs_Constraint aNewConstraint = Slvs_MakeConstraint(SLVS_E_UNKNOWN, myGroup->getId(),
SLVS_C_POINTS_COINCIDENT, myGroup->getWorkplaneId(), 0.0, thePoint1, thePoint2,
SLVS_E_UNKNOWN, SLVS_E_UNKNOWN);
Slvs_hConstraint aNewID = myStorage->addConstraint(aNewConstraint);
+ if (!hasDuplicated && myStorage->hasDuplicatedConstraint()) {
+ // the duplicated constraint appears
+ myStorage->removeConstraint(aNewID);
+ return SLVS_E_UNKNOWN;
+ }
mySlvsConstraints.push_back(aNewID);
return aNewID;
}
myExtraCoincidence[aNewConstr] = theConstraint;
}
+void SketchSolver_ConstraintCoincidence::process()
+{
+ SketchSolver_Constraint::process();
+
+ // Fill the list of coincident points
+ std::list<AttributePtr> anAttrList =
+ myBaseConstraint->data()->attributes(ModelAPI_AttributeRefAttr::typeId());
+ std::list<AttributePtr>::iterator anIt = anAttrList.begin();
+ for (; anIt != anAttrList.end(); anIt++) {
+ AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anIt);
+ if (!aRefAttr || aRefAttr->isObject())
+ continue;
+ myCoincidentPoints.insert(aRefAttr->attr());
+ }
+}
+
bool SketchSolver_ConstraintCoincidence::remove(ConstraintPtr theConstraint)
{
cleanErrorMsg();
/// \brief Append all data of coincidence constaint to the current
void attach(std::shared_ptr<SketchSolver_ConstraintCoincidence> theConstraint);
+protected:
+ /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
+ virtual void process();
+
private:
/// \brief Creates new coincidence constraint
Slvs_hConstraint addConstraint(Slvs_hEntity thePoint1, Slvs_hEntity thePoint2);
// Set the mirror line unchanged during constraint recalculation
for (int i = 0; i < 2; i++) {
+ if (myStorage->isPointFixed(aMirrorLine.point[i], aConstraint.h, true))
+ continue;
aConstraint = Slvs_MakeConstraint(
SLVS_E_UNKNOWN, myGroup->getId(), SLVS_C_WHERE_DRAGGED, myGroup->getWorkplaneId(), 0.0,
aMirrorLine.point[i], SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN);
aResult = myConstrSolver.solve();
if (aResult == SLVS_RESULT_OKAY || aNbTemp <= 0)
break;
- aNbTemp = myStorage->removeFirstTemporaryConstraint();
+ aNbTemp = myStorage->deleteTemporaryConstraint();
myStorage->initializeSolver(myConstrSolver);
}
}
myTemporaryConstraints.clear();
}
-int SketchSolver_Storage::removeFirstTemporaryConstraint()
+int SketchSolver_Storage::deleteTemporaryConstraint()
{
if (myTemporaryConstraints.empty())
return 0;
- removeConstraint(*myTemporaryConstraints.begin());
- myTemporaryConstraints.erase(myTemporaryConstraints.begin());
+ // Search the point-on-line or a non-rigid constraint
+ std::set<Slvs_hConstraint>::iterator aCIt = myTemporaryConstraints.begin();
+ for (; aCIt != myTemporaryConstraints.end(); aCIt++) {
+ int aPos = Search(*aCIt, myConstraints);
+ if (myConstraints[aPos].type != SLVS_C_WHERE_DRAGGED)
+ break;
+ std::vector<Slvs_Constraint>::iterator anIt = myConstraints.begin();
+ for (; anIt != myConstraints.end(); anIt++)
+ if (anIt->type == SLVS_C_PT_ON_LINE && anIt->ptA == myConstraints[aPos].ptA)
+ break;
+ if (anIt != myConstraints.end())
+ break;
+ }
+ if (aCIt == myTemporaryConstraints.end())
+ aCIt = myTemporaryConstraints.begin();
+ bool aNewFixed = (*aCIt == myFixed);
+ removeConstraint(*aCIt);
+ myTemporaryConstraints.erase(aCIt);
+ if (aNewFixed) {
+ for (aCIt = myTemporaryConstraints.begin(); aCIt != myTemporaryConstraints.end(); aCIt++) {
+ int aPos = Search(*aCIt, myConstraints);
+ if (myConstraints[aPos].type == SLVS_C_WHERE_DRAGGED) {
+ myFixed = *aCIt;
+ break;
+ }
+ }
+ }
return (int)myTemporaryConstraints.size();
}
void addTemporaryConstraint(const Slvs_hConstraint& theConstraintID);
/// \brief Remove all transient constraints
void removeTemporaryConstraints();
- /// \brief Remove first temporary constraint
+ /// \brief Remove one temporary constraint. Preferable to remove the points under Point-on-Line constraint
/// \return Number of remaining temporary constraints
- int removeFirstTemporaryConstraint();
+ int deleteTemporaryConstraint();
/// \brief Checks the constraint is temporary
bool isTemporary(const Slvs_hConstraint& theConstraintID) const;
/// \brief Shows the sketch should be resolved
bool isNeedToResolve() const
- { return myNeedToResolve; }
+ { return myNeedToResolve && !myConstraints.empty(); }
/// \brief Shows the storage has the same constraint twice
bool hasDuplicatedConstraint() const
#include "XGUI_ViewerProxy.h"
#include "XGUI_Selection.h"
#include "XGUI_SalomeConnector.h"
+#include "XGUI_Tools.h"
#include <AppElements_MainWindow.h>
bool hasResult = false;
bool hasFeature = false;
bool hasParameter = false;
- foreach(ObjectPtr aObj, aObjects)
- {
- FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
- ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
- ResultParameterPtr aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aResult);
-
- hasResult = (aResult.get() != NULL);
- hasFeature = (aFeature.get() != NULL);
- hasParameter = (aConstruction.get() != NULL);
- if (hasFeature && hasResult && hasParameter)
- break;
- }
+ XGUI_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter);
+
//Process Feature
if (aSelected == 1) {
ObjectPtr aObject = aObjects.first();
AttributeDoublePtr aValueAttribute = aParam->data()->real(ModelAPI_ResultParameter::VALUE());
QString aVal = QString::number(aValueAttribute->value());
QString aTitle = QString(aObject->data()->name().c_str());
- return aTitle + "=" + aVal;
+ return aTitle + " = " + aVal;
}
}
break;
AttributeDoublePtr aValueAttribute = aParam->data()->real(ModelAPI_ResultParameter::VALUE());
QString aVal = QString::number(aValueAttribute->value());
QString aTitle = QString(aObject->data()->name().c_str());
- return aTitle + "=" + aVal;
+ return aTitle + " = " + aVal;
}
}
break;
#include <TopoDS_Shape.hxx>
#include <ModelAPI_Object.h>
+#include <ModelAPI_Result.h>
+#include <ModelAPI_ResultParameter.h>
+#include <ModelAPI_Feature.h>
#include <GeomAPI_Shape.h>
#include <QDir>
}
}*/
+
+void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature, bool& hasParameter)
+{
+ hasResult = false;
+ hasFeature = false;
+ hasParameter = false;
+ foreach(ObjectPtr aObj, theObjects) {
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
+ ResultParameterPtr aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aResult);
+
+ hasResult = (aResult.get() != NULL);
+ hasFeature = (aFeature.get() != NULL);
+ hasParameter = (aConstruction.get() != NULL);
+ if (hasFeature && hasResult && hasParameter)
+ break;
+ }
+}
+
+
}
#include <QRect>
#include <ModelAPI_Feature.h>
+#include <ModuleBase_Definitions.h>
#include <memory>
\param theFeature a feature
*/
std::string XGUI_EXPORT featureInfo(FeaturePtr theFeature);
-}
+
+
+/*!
+Check types of objects which are in the given list
+\param theObjects the list of objects
+\param hasResult will be set to true if list contains Result objects
+\param hasFeature will be set to true if list contains Feature objects
+\param hasParameter will be set to true if list contains Parameter objects
+*/
+void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature, bool& hasParameter);
+
+};
#endif
if (!isActiveOperationAborted())
return;
QObjectPtrList anObjects = mySelector->selection()->selectedObjects();
+ bool hasResult = false;
+ bool hasFeature = false;
+ bool hasParameter = false;
+ XGUI_Tools::checkObjects(anObjects, hasResult, hasFeature, hasParameter);
+ if (!(hasFeature || hasParameter))
+ return;
+
// 1. start operation
QString aDescription = contextMenuMgr()->action("DELETE_CMD")->text();
aDescription += tr(" %1");
<file>pictures/constr_object.png</file>
<file>pictures/constr_object_modified.png</file>
<file>pictures/part_ico.png</file>
+ <file>pictures/box_ico.png</file>
<file>pictures/properties.png</file>
<file>pictures/features.png</file>
<file>pictures/point_ico.png</file>