From: vsv Date: Fri, 27 Mar 2020 10:18:56 +0000 (+0300) Subject: Issue #2999: Improve selection precision for Arcs and Circles X-Git-Tag: V9_5_0a2~16 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dc3d68829a740f0182d08dc603818675ab22b2da;p=modules%2Fshaper.git Issue #2999: Improve selection precision for Arcs and Circles --- diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index a860f61cd..5149a6334 100644 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -21,6 +21,7 @@ #include "ModuleBase_IViewer.h" #include +#include #include #include @@ -33,6 +34,7 @@ #include #include +#include #include #include @@ -56,6 +58,8 @@ #include #include #include +#include +#include //******************************************************************************************* @@ -68,8 +72,25 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) : ViewerData_AISShape(TopoDS_Shape()), myResult(theResult), myAdditionalSelectionPriority(0), myTransparency(1), myIsSubstituted(false) { - std::shared_ptr aShapePtr = ModelAPI_Tools::shape(theResult); + + GeomShapePtr aShapePtr = ModelAPI_Tools::shape(theResult); TopoDS_Shape aShape = aShapePtr->impl(); + // Workaround for Sketch subshapes which has no discrete representation + // until sketch faces are built and displayed. + // Thus, perform discretization of such edges. + if (theResult->groupName() == ModelAPI_ResultConstruction::group() && + aShape.ShapeType() == TopAbs_EDGE) { + GeomEdgePtr anEdgePtr = GeomEdgePtr(new GeomAPI_Edge(aShapePtr)); + if (anEdgePtr->isCircle() || anEdgePtr->isArc()) { + TopoDS_Edge anEdge = TopoDS::Edge(aShape); + TopLoc_Location aLoc; + Handle(Poly_Polygon3D) aPoly3D = BRep_Tool::Polygon3D(anEdge, aLoc); + if (aPoly3D.IsNull()) { + double aDeflection = Config_PropManager::real("Visualization", "body_deflection"); + BRepMesh_IncrementalMesh(aShape, aDeflection); + } + } + } Set(aShape); // Activate individual repaintng if this is a part of compsolid