X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomValidators%2FGeomValidators_Face.cpp;h=c8797278b42d94c15b4674c65d4233594deac427;hb=6239c1880d74ea741d49e06ab9d24b1d9e63a0dc;hp=821b45cb0755d58d8e11b839b9167a4817beb3d1;hpb=a0f9fa9b8b14687a645ff6c92231d3a927167d68;p=modules%2Fshaper.git diff --git a/src/GeomValidators/GeomValidators_Face.cpp b/src/GeomValidators/GeomValidators_Face.cpp index 821b45cb0..c8797278b 100644 --- a/src/GeomValidators/GeomValidators_Face.cpp +++ b/src/GeomValidators/GeomValidators_Face.cpp @@ -46,16 +46,26 @@ bool GeomValidators_Face::isValid(const AttributePtr& theAttribute, AttributeSelectionPtr aSelectionAttr = std::dynamic_pointer_cast (theAttribute); std::shared_ptr aGeomShape = aSelectionAttr->value(); - std::shared_ptr aGeomFace(new GeomAPI_Face(aGeomShape)); - if (aGeomFace.get() != NULL) { - switch(aFaceType) { - case GeomAbs_Plane: - aValid = aGeomFace->isPlanar(); - break; - case GeomAbs_Cylinder: - break; - default: - break; + if (!aGeomShape.get()) { + // if the shape is empty, apply the validator to the shape of result + aGeomShape = aSelectionAttr->context()->shape(); + } + // it is necessary to check whether the shape is face in order to set in selection a value + // with any type and check the type in this validator + // It is realized to select any object in OB and filter it in this validator (sketch plane) + if (aGeomShape->isFace()) { + std::shared_ptr aGeomFace(new GeomAPI_Face(aGeomShape)); + if (aGeomFace.get() != NULL) { + switch(aFaceType) { + case GeomAbs_Plane: + aValid = aGeomFace->isPlanar(); + break; + case GeomAbs_Cylinder: + aValid = aGeomFace->isCylindrical(); + break; + default: + break; + } } } }