-// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#include <Standard_Stream.hxx>
#include <GEOM_Function.hxx>
#include <ShHealOper_Sewing.hxx>
-#include <NMTAlgo_Splitter1.hxx>
+#include <ShHealOper_ShapeProcess.hxx>
+#include <GEOMAlgo_Gluer.hxx>
#include <BlockFix_BlockFixAPI.hxx>
#include "utilities.h"
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_MakePolygon.hxx>
#include <BRepBuilderAPI_Transform.hxx>
+#include <BRepCheck_Analyzer.hxx>
#include <BRepClass_FaceClassifier.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <BRepExtrema_ExtPF.hxx>
TopoDS_Shape aCompound = anArgs(1);
// Glue coincident faces and edges (with Partition algorithm).
- NMTAlgo_Splitter1 PS;
- PS.AddShape(aCompound);
- PS.Compute();
- PS.SetRemoveWebs(Standard_False);
-// PS.Build(aCompound.ShapeType());
- PS.Build(TopAbs_SOLID);
-
- aShape = PS.Shape();
+ //NMTAlgo_Splitter1 PS;
+ //PS.AddShape(aCompound);
+ //PS.Compute();
+ //PS.SetRemoveWebs(Standard_False);
+ // PS.Build(aCompound.ShapeType());
+ //PS.Build(TopAbs_SOLID);
+ //aShape = PS.Shape();
+
+ GEOMAlgo_Gluer aGluer;
+ aGluer.SetShape(aCompound);
+ aGluer.SetCheckGeometry(Standard_True);
+ aGluer.Perform();
+ aShape = aGluer.Result();
+
+
} else {
}
// 1. Improve solids with seam and/or degenerated edges
BlockFix_BlockFixAPI aTool;
//aTool.Tolerance() = toler;
+ aTool.OptimumNbFaces() = aCI.GetOptimumNbFaces();
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
}
// 5. Glue Faces
- aShape = GEOMImpl_GlueDriver::GlueFaces(aComp, Precision::Confusion());
+ aShape = GEOMImpl_GlueDriver::GlueFaces(aComp, Precision::Confusion(), Standard_False);
}
} else if (aType == BLOCK_MULTI_TRANSFORM_1D ||
}
// Glue faces of the multi-block
- aShape = GEOMImpl_GlueDriver::GlueFaces(aMulti, aTol);
+ aShape = GEOMImpl_GlueDriver::GlueFaces(aMulti, aTol, Standard_False);
} else { // unknown function type
return 0;