]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2728: Accept result part as possible base of sketch
authorvsv <vsv@opencascade.com>
Mon, 29 Oct 2018 13:58:50 +0000 (16:58 +0300)
committermpv <mpv@opencascade.com>
Mon, 19 Nov 2018 08:45:52 +0000 (11:45 +0300)
src/PartSet/PartSet_PreviewPlanes.cpp
src/PartSet/PartSet_WidgetSketchLabel.cpp

index 7585f21be350561ffb95193bcca7cc5641c6f114..961c35ccb43b7fa3b3f9a85eed5d8536178b2681 100755 (executable)
@@ -24,6 +24,7 @@
 
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_ResultConstruction.h>
+#include <ModelAPI_ResultPart.h>
 
 #include <XGUI_Tools.h>
 #include <XGUI_Displayer.h>
@@ -49,7 +50,9 @@ bool PartSet_PreviewPlanes::hasVisualizedBodies(ModuleBase_IWorkshop* theWorksho
   foreach (ObjectPtr anObj, aDisplayed) {
     ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(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
index 8714eb98d5d4fe387583b7772b3079bc3acd9585..14c7fbe576df29fc159cde3c618d86a771cc4900 100644 (file)
@@ -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<TopoDS_Shape>();
           setSketchPlane(aTDShape);
           isOwnerSet = true;