Salome HOME
Change icons for chamfer
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Trim.cpp
index af67ca006e368ecbe08cc1988007fcacc0245423..66d7157c1abb0fb372a78cb862de0585aa19a9be 100644 (file)
@@ -239,6 +239,10 @@ void SketchPlugin_Trim::execute()
   std::cout << " Base Feature: " << aBaseFeature->data()->name() << std::endl;
 #endif
   findShapePoints(SELECTED_OBJECT(), SELECTED_POINT(), aStartShapePoint, aLastShapePoint);
+  if (!aStartShapePoint || !aLastShapePoint) {
+    setError("Error: Selected point is not placed on any edge");
+    return;
+  }
 
   std::shared_ptr<GeomAPI_Pnt2d> aStartShapePoint2d = convertPoint(aStartShapePoint);
   std::shared_ptr<GeomAPI_Pnt2d> aLastShapePoint2d = convertPoint(aLastShapePoint);
@@ -291,6 +295,9 @@ void SketchPlugin_Trim::execute()
   std::cout << "[" << aRefsToFeature.size() << "] " << aRefsInfo << std::endl;
   std::cout << "---- getRefAttributes:end ----" << std::endl;
 #endif
+
+  keepCurrentFeature();
+
   std::set<AttributePoint2DPtr> aFurtherCoincidences;
   std::set<std::pair<AttributePtr, AttributePtr>> aModifiedAttributes;
   const std::string& aKind = aBaseFeature->getKind();
@@ -314,6 +321,8 @@ void SketchPlugin_Trim::execute()
                           aFurtherCoincidences, aModifiedAttributes);
   }
 
+  restoreCurrentFeature();
+
   // constraints to end points of trim feature
   if (myObjectToPoints.find(aBaseObject) == myObjectToPoints.end())
     fillObjectShapes(aBaseObject, sketch()->data()->owner(), myCashedShapes, myObjectToPoints);