From da89d1e8b958b5677dbf4025a623e10be062c51c Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 16 Oct 2018 18:18:52 +0300 Subject: [PATCH] Issue #2702: Accept feature of a plane as a sketcher plane --- src/ModuleBase/ModuleBase_WidgetValidated.cpp | 3 +++ src/PartSet/PartSet_WidgetSketchLabel.cpp | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.cpp b/src/ModuleBase/ModuleBase_WidgetValidated.cpp index 308e14770..6fbd9b174 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.cpp +++ b/src/ModuleBase/ModuleBase_WidgetValidated.cpp @@ -130,6 +130,9 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrsPtr& std::dynamic_pointer_cast(anAttr); aSelectAttr->setValue(myPresentedObject, GeomShapePtr(), true); GeomShapePtr aShape = aSelectAttr->value(); + if (!aShape.get() && aSelectAttr->contextFeature()->firstResult().get()) { + aShape = aSelectAttr->contextFeature()->firstResult()->shape(); + } if (aShape.get()) { const TopoDS_Shape aTDShape = aShape->impl(); Handle(AIS_InteractiveObject) anIO = myWorkshop->selection()->getIO(thePrs); diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index 03007a3eb..8714eb98d 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -462,6 +462,18 @@ bool PartSet_WidgetSketchLabel::fillSketchPlaneBySelection(const ModuleBase_View isOwnerSet = true; } } + else { + aSelAttr->setValue(aFeature, GeomShapePtr()); + GeomShapePtr aShape = aSelAttr->value(); + if (!aShape.get() && aSelAttr->contextFeature()->firstResult().get()) { + aShape = aSelAttr->contextFeature()->firstResult()->shape(); + } + if (aShape.get()) { + const TopoDS_Shape& aTDShape = aShape->impl(); + setSketchPlane(aTDShape); + isOwnerSet = true; + } + } } } return isOwnerSet; -- 2.39.2