From: jfa Date: Fri, 21 Nov 2008 07:33:55 +0000 (+0000) Subject: Heal invalid shape after scaling, because different scaling along axes can produce... X-Git-Tag: V5_1_0rc2~26 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=820d7c8eb9cea44dc36f161a62d8238fa131d559;p=modules%2Fgeom.git Heal invalid shape after scaling, because different scaling along axes can produce invalid shapes in some cases. --- diff --git a/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx b/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx index 8dc4967d2..7fa066a53 100644 --- a/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx @@ -25,10 +25,15 @@ #include #include +#include +#include + #include #include #include #include +#include + #include #include #include @@ -168,8 +173,19 @@ Standard_Integer GEOMImpl_ScaleDriver::Execute(TFunction_Logbook& log) const if (aShape.IsNull()) return 0; - if (!BRepAlgo::IsValid(aShape)) - Standard_ConstructionError::Raise("Scaling aborted : non valid shape result"); + BRepCheck_Analyzer ana (aShape, Standard_False); + if (!ana.IsValid()) { + ShapeFix_ShapeTolerance aSFT; + aSFT.LimitTolerance(aShape,Precision::Confusion(),Precision::Confusion()); + Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape); + aSfs->SetPrecision(Precision::Confusion()); + aSfs->Perform(); + aShape = aSfs->Shape(); + + ana.Init(aShape, Standard_False); + if (!ana.IsValid()) + Standard_ConstructionError::Raise("Scaling aborted : algorithm has produced an invalid shape result"); + } aFunction->SetValue(aShape);