From 77f03a4d00adc1ae5c8ff0a0cb8f50a04d739f8d Mon Sep 17 00:00:00 2001 From: jfa Date: Tue, 18 Mar 2008 10:22:32 +0000 Subject: [PATCH] NPAL19230: Fix shape after RemoveExtraEdges, because sometimes it is not valid. --- src/GEOMImpl/GEOMImpl_BlockDriver.cxx | 28 +++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/GEOMImpl/GEOMImpl_BlockDriver.cxx b/src/GEOMImpl/GEOMImpl_BlockDriver.cxx index 2efdd7ca2..873b0a751 100644 --- a/src/GEOMImpl/GEOMImpl_BlockDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BlockDriver.cxx @@ -34,7 +34,7 @@ #include #include -//#include +#include #include #include @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -507,17 +508,28 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const aTool.SetShape(aBlockOrComp); aTool.Perform(); - if (aType == BLOCK_REMOVE_EXTRA) { + TopoDS_Shape aFixedExtra = aTool.Shape(); + + // Repair result + BRepCheck_Analyzer ana (aFixedExtra, false); + if (!ana.IsValid()) { + TopoDS_Shape aFixed; + ShHealOper_ShapeProcess aHealer; + aHealer.Perform(aFixedExtra, aFixed); + if (aHealer.isDone()) + aFixedExtra = aFixed; + } + + if (aType == BLOCK_REMOVE_EXTRA) + { + aShape = aFixedExtra; - aShape = aTool.Shape(); if (aShape == aBlockOrComp) { MESSAGE("No modifications have been done"); } - - } else { // aType == BLOCK_COMPOUND_IMPROVE - - TopoDS_Shape aFixedExtra = aTool.Shape(); - + } + else // aType == BLOCK_COMPOUND_IMPROVE + { // 2. Separate non-blocks TopTools_ListOfShape BLO; // All blocks from the given compound TopTools_ListOfShape NOT; // Not blocks -- 2.39.2