#include <ModelAPI_ResultConstruction.h>
#include <GeomAPI_PlanarEdges.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <Events_Loop.h>
#include <SketchPlugin_SketchEntity.h>
+#include <SketcherPrs_Tools.h>
+
#include <Config_PropManager.h>
#include <BRep_Builder.hxx>
setAuxiliaryPresentationStyle(false);
// change deviation coefficient to provide more precise circle
- ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), Attributes());
+ ModuleBase_Tools::setDefaultDeviationCoefficient(myResult, Attributes());
AIS_Shape::Compute(thePresentationManager, thePresentation, theMode);
if (!myAuxiliaryCompound.IsNull()) {
}
if (!aReadyToDisplay) {
- Events_Error::throwException("An empty AIS presentation: PartSet_ResultSketchPrs");
+ Events_InfoMessage("PartSet_ResultSketchPrs", "An empty AIS presentation: PartSet_ResultSketchPrs").send();
static const Events_ID anEvent = Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION);
ModelAPI_EventCreator::get()->sendUpdated(myResult, anEvent);
}
#endif
void PartSet_ResultSketchPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
- const Standard_Integer aMode)
+ const Standard_Integer theMode)
{
- if (aMode > 8)
+ int aMode = theMode;
+
+ if (aMode > 8 &&
+ aMode != SketcherPrs_Tools::Sel_Sketch_Face &&
+ aMode != SketcherPrs_Tools::Sel_Sketch_Wire)
// In order to avoid using custom selection modes
return;
- if (aMode == AIS_Shape::SelectionMode(TopAbs_FACE)) {
+ bool aShapeIsChanged = false;
+ if (aMode == SketcherPrs_Tools::Sel_Sketch_Face ||
+ aMode == SketcherPrs_Tools::Sel_Sketch_Wire) {
+ aMode = (aMode == SketcherPrs_Tools::Sel_Sketch_Face) ? AIS_Shape::SelectionMode(TopAbs_FACE)
+ : AIS_Shape::SelectionMode(TopAbs_WIRE);
#ifdef DEBUG_WIRE
const TopoDS_Shape& aShape = Shape();
debugInfo(aShape, TopAbs_VERTEX); // 24
for(NCollection_List<TopoDS_Shape>::Iterator anIt(mySketchFaceList); anIt.More(); anIt.Next()) {
const TopoDS_Shape& aFace = anIt.Value();
aBuilder.Add(aComp, aFace);
- // for sketch presentation in the face mode wires should be selectable also
- // accoring to #1343 Improvement of Extrusion and Revolution operations
- appendShapeSelection(aSelection, aFace, TopAbs_WIRE);
}
#ifdef DEBUG_WIRE
debugInfo(aComp, TopAbs_VERTEX); // 24
debugInfo(aComp, TopAbs_FACE); // 2
#endif
Set(aComp);
- } else
+ aShapeIsChanged = true;
+ }
+ else
Set(myOriginalShape);
// append auxiliary compound to selection of edges/vertices
if (aMode == AIS_Shape::SelectionMode(TopAbs_EDGE) ||
aMode == AIS_Shape::SelectionMode(TopAbs_VERTEX)) {
- bool isVertex = aMode == AIS_Shape::SelectionMode(TopAbs_VERTEX);
+ bool isVertex = aMode == AIS_Shape::SelectionMode(TopAbs_VERTEX);
appendShapeSelection(aSelection, myAuxiliaryCompound, isVertex ? TopAbs_VERTEX : TopAbs_EDGE);
}
AIS_Shape::ComputeSelection(aSelection, aMode);
+
+ if (aShapeIsChanged)
+ Set(myOriginalShape);
}
void PartSet_ResultSketchPrs::appendShapeSelection(const Handle(SelectMgr_Selection)& theSelection,