From 9c037e806d4fb7a1c6129713020962a2e6f52411 Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 28 Oct 2014 20:30:12 +0300 Subject: [PATCH] Provide dimensions edit --- src/ModuleBase/ModuleBase_Operation.cpp | 20 +++++++++++++++++++- src/ModuleBase/ModuleBase_ViewerFilters.cpp | 3 ++- src/PartSet/PartSet_OperationSketch.cpp | 3 ++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index b4c4c01d1..3f29da130 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -279,7 +280,24 @@ bool ModuleBase_Operation::activateByPreselection() void ModuleBase_Operation::initSelection(ModuleBase_ISelection* theSelection) { - myPreSelection = theSelection->getSelected(); + myPreSelection.clear(); + + // Check that the selected result are not results of operation feature + QList aSelected = theSelection->getSelected(); + FeaturePtr aFeature = feature(); + if (aFeature) { + std::list aResults = aFeature->results(); + QList aResList; + std::list::const_iterator aIt; + for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) + aResList.append(*aIt); + + foreach (ModuleBase_ViewerPrs aPrs, aSelected) { + if ((!aResList.contains(aPrs.object())) && (aPrs.object() != aFeature)) + myPreSelection.append(aPrs); + } + } else + myPreSelection = aSelected; } void ModuleBase_Operation::onWidgetActivated(ModuleBase_ModelWidget* theWidget) diff --git a/src/ModuleBase/ModuleBase_ViewerFilters.cpp b/src/ModuleBase/ModuleBase_ViewerFilters.cpp index 6d2209de5..4b6e571df 100644 --- a/src/ModuleBase/ModuleBase_ViewerFilters.cpp +++ b/src/ModuleBase/ModuleBase_ViewerFilters.cpp @@ -76,5 +76,6 @@ Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk(const Handle(SelectMgr_Enti } } } - return Standard_False; + // This is not object controlled by the filter + return Standard_True; } diff --git a/src/PartSet/PartSet_OperationSketch.cpp b/src/PartSet/PartSet_OperationSketch.cpp index 804086bbe..331f7e63e 100644 --- a/src/PartSet/PartSet_OperationSketch.cpp +++ b/src/PartSet/PartSet_OperationSketch.cpp @@ -87,12 +87,13 @@ void PartSet_OperationSketch::mousePressed(QMouseEvent* theEvent, ModuleBase_IVi void PartSet_OperationSketch::selectionChanged(ModuleBase_ISelection* theSelection) { - if (hasSketchPlane()) + if (hasSketchPlane()) return; QList aSelected = theSelection->getSelected(); if (!aSelected.empty()) { ModuleBase_ViewerPrs aPrs = aSelected.first(); + // We have to select a plane before any operation const TopoDS_Shape& aShape = aPrs.shape(); if (!aShape.IsNull()) setSketchPlane(aShape); -- 2.39.2