From 313921a3d01b704b94177223ba85ef0bad283eb2 Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 29 Oct 2018 16:58:50 +0300 Subject: [PATCH] Issue #2728: Accept result part as possible base of sketch --- src/PartSet/PartSet_PreviewPlanes.cpp | 5 ++++- src/PartSet/PartSet_WidgetSketchLabel.cpp | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/PartSet/PartSet_PreviewPlanes.cpp b/src/PartSet/PartSet_PreviewPlanes.cpp index 7585f21be..961c35ccb 100755 --- a/src/PartSet/PartSet_PreviewPlanes.cpp +++ b/src/PartSet/PartSet_PreviewPlanes.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -49,7 +50,9 @@ bool PartSet_PreviewPlanes::hasVisualizedBodies(ModuleBase_IWorkshop* theWorksho foreach (ObjectPtr anObj, aDisplayed) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); // result constructions should not be taken as a body - if (aResult.get() != NULL && aResult->groupName() == ModelAPI_ResultBody::group()) { + if (aResult.get() != NULL && + ((aResult->groupName() == ModelAPI_ResultBody::group()) || + ((aResult->groupName() == ModelAPI_ResultPart::group()))) ) { GeomShapePtr aShape = aResult->shape(); if (aShape.get()) { // vertices, edges should not be taken as a body diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index 8714eb98d..14c7fbe57 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -465,10 +465,11 @@ bool PartSet_WidgetSketchLabel::fillSketchPlaneBySelection(const ModuleBase_View else { aSelAttr->setValue(aFeature, GeomShapePtr()); GeomShapePtr aShape = aSelAttr->value(); - if (!aShape.get() && aSelAttr->contextFeature()->firstResult().get()) { + if (!aShape.get() && aSelAttr->contextFeature().get() && + aSelAttr->contextFeature()->firstResult().get()) { aShape = aSelAttr->contextFeature()->firstResult()->shape(); } - if (aShape.get()) { + if (aShape.get() && aShape->isPlanar()) { const TopoDS_Shape& aTDShape = aShape->impl(); setSketchPlane(aTDShape); isOwnerSet = true; -- 2.39.2