From d570a46bdbeb5b2279f04a4746de7da413f0b0a6 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 20 Sep 2018 17:48:07 +0300 Subject: [PATCH] Issue #2632: Process Features in selection checking its shape from result --- src/ModuleBase/ModuleBase_WidgetValidated.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.cpp b/src/ModuleBase/ModuleBase_WidgetValidated.cpp index b59050037..7ecc5a955 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.cpp +++ b/src/ModuleBase/ModuleBase_WidgetValidated.cpp @@ -123,6 +123,7 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrsPtr& myPresentedObject = aFeature; AttributePtr anAttr = attribute(); std::string aType = anAttr->attributeType(); + // Check that results of Feature is acceptable by filters for selection attribute if (aType == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr aSelectAttr = @@ -136,8 +137,18 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrsPtr& } aSelectAttr->setValue(ObjectPtr(), GeomShapePtr(), true); } - else - aValid = false; // only results with a shape can be filtered + else { + ResultPtr aResult = aFeature->firstResult(); + if (aResult.get()) { + GeomShapePtr aShapePtr = ModelAPI_Tools::shape(aResult); + if (aShapePtr.get()) { + const TopoDS_Shape aTDShape = aShapePtr->impl(); + Handle(AIS_InteractiveObject) anIO = myWorkshop->selection()->getIO(thePrs); + anOwner = new StdSelect_BRepOwner(aTDShape, anIO); + } + } + aValid = !anOwner.IsNull(); // only results with a shape can be filtered + } } else aValid = false; // only results with a shape can be filtered } -- 2.39.2