From: vsv Date: Fri, 31 Oct 2014 12:14:18 +0000 (+0300) Subject: Use selection attribute for sketch plane X-Git-Tag: V_0.5~51 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8c5060e46293ecbfcc7d9f33041e8cb279c62382;p=modules%2Fshaper.git Use selection attribute for sketch plane --- diff --git a/src/PartSet/PartSet_OperationSketch.cpp b/src/PartSet/PartSet_OperationSketch.cpp index 331f7e63e..64f77867c 100644 --- a/src/PartSet/PartSet_OperationSketch.cpp +++ b/src/PartSet/PartSet_OperationSketch.cpp @@ -94,9 +94,28 @@ void PartSet_OperationSketch::selectionChanged(ModuleBase_ISelection* theSelecti 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()) + TopoDS_Shape aShape = aPrs.shape(); + if (!aShape.IsNull()) { setSketchPlane(aShape); + // If selection is not a sketcher presentation then it has to be stored as + // External shape + if (feature() != aPrs.object()) { + boost::shared_ptr aSketch = + boost::dynamic_pointer_cast(feature()); + DataPtr aData = aSketch->data(); + AttributeSelectionPtr aSelAttr = + boost::dynamic_pointer_cast + (aData->attribute(SketchPlugin_Feature::EXTERNAL_ID())); + if (aSelAttr) { + ResultPtr aRes = boost::dynamic_pointer_cast(aPrs.object()); + if (aRes) { + GeomShapePtr aShapePtr(new GeomAPI_Shape()); + aShapePtr->setImpl(new TopoDS_Shape(aShape)); + aSelAttr->setValue(aRes, aShapePtr); + } + } + } + } } }