Salome HOME
Issue #2998: Add help description for automatic creation of constraints
[modules/shaper.git] / src / FiltersPlugin / FiltersPlugin_OnPlane.cpp
index b9f6329560cf737813e4d96767aeacf886133400..8ee128dc74f90646788ffb32987c5429766c07cd 100644 (file)
@@ -48,6 +48,9 @@ bool FiltersPlugin_OnPlane::isSupported(GeomAPI_Shape::ShapeType theType) const
 GeomPlanePtr getPlane(AttributeSelectionPtr theAttr)
 {
   GeomShapePtr aGeom = theAttr->value();
+  if (!aGeom.get()) {  // construction plane, #2942
+    aGeom = theAttr->context()->shape();
+  }
   GeomFacePtr aFace(new GeomAPI_Face(aGeom));
   return aFace->getPlane();
 }
@@ -80,14 +83,10 @@ bool FiltersPlugin_OnPlane::isOk(const GeomShapePtr& theShape, const ResultPtr&,
           return true;
       }
     }
-    else if (aEdge->isCircle()) {
-      GeomCurvePtr aCurve(new GeomAPI_Curve(aEdge));
-      GeomCirclePtr aCircle(new GeomAPI_Circ(aCurve));
-      GeomDirPtr aDir = aCircle->normal();
-      GeomPointPtr aPnt = aCircle->center();
+    else if (aEdge->isPlanar()) {
       for (int i = 0; i < aList->size(); i++) {
         GeomPlanePtr aPlane = getPlane(aList->value(i));
-        if ((aPlane->direction()->isParallel(aDir)) && (aPlane->distance(aPnt) < LIN_TOLERANCE))
+        if (aEdge->isInPlane(aPlane))
           return true;
       }
     }