PAL12149: Cannot create non-planar shells. Non-planar faces creation algorithm improved.

This commit is contained in:
jfa 2006-04-13 09:20:20 +00:00
parent 2e76e5e42e
commit aeeebe32c2

View File

@ -19,10 +19,10 @@
// //
#include <Standard_Stream.hxx> #include <Standard_Stream.hxx>
#include <BRepOffsetAPI_MakeFilling.hxx>
#include <GEOMImpl_Block6Explorer.hxx> #include <GEOMImpl_Block6Explorer.hxx>
#include <ShHealOper_ShapeProcess.hxx>
#include "utilities.h" #include "utilities.h"
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
@ -33,6 +33,8 @@
#include <BRepTools.hxx> #include <BRepTools.hxx>
#include <BRepTools_WireExplorer.hxx> #include <BRepTools_WireExplorer.hxx>
#include <BRepOffsetAPI_ThruSections.hxx> #include <BRepOffsetAPI_ThruSections.hxx>
#include <BRepOffsetAPI_MakeFilling.hxx>
#include <BRepCheck_Analyzer.hxx>
#include <BRepBuilderAPI_Copy.hxx> #include <BRepBuilderAPI_Copy.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx> #include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx> #include <BRepBuilderAPI_MakeWire.hxx>
@ -1202,6 +1204,24 @@ void GEOMImpl_Block6Explorer::MakeFace (const TopoDS_Wire& theWire,
// Result of filling // Result of filling
TopoDS_Shape aFace = MF.Shape(); TopoDS_Shape aFace = MF.Shape();
// 12.04.2006 for PAL12149 begin
Handle(Geom_Surface) aGS = BRep_Tool::Surface(TopoDS::Face(aFace));
BRepBuilderAPI_MakeFace MK1 (aGS, theWire);
if (MK1.IsDone()) {
TopoDS_Shape aFace1 = MK1.Shape();
BRepCheck_Analyzer ana (aFace1, false);
if (!ana.IsValid()) {
TopoDS_Shape aFace2;
ShHealOper_ShapeProcess aHealer;
aHealer.Perform(aFace1, aFace2);
if (aHealer.isDone())
theResult = aFace2;
}
}
// 12.04.2006 for PAL12149 end
if (theResult.IsNull()) { // try to deal with pure result of filling
// Update tolerance // Update tolerance
Standard_Real aTol = MF.G0Error(); Standard_Real aTol = MF.G0Error();
@ -1234,11 +1254,11 @@ void GEOMImpl_Block6Explorer::MakeFace (const TopoDS_Wire& theWire,
} }
theResult = aFace; theResult = aFace;
} }
}
} else { } else {
// try to update wire tolerances to build a planar face // try to update wire tolerances to build a planar face
// With OCCT6.0 or lower #if 1 //(OCC_VERSION_MAJOR < 6) || (OCC_VERSION_MAJOR == 6 && OCC_VERSION_MINOR <= 1)
// Find a deviation // Find a deviation
Standard_Real aToleranceReached, aTol; Standard_Real aToleranceReached, aTol;
BRepLib_FindSurface aFS; BRepLib_FindSurface aFS;
@ -1276,12 +1296,13 @@ void GEOMImpl_Block6Explorer::MakeFace (const TopoDS_Wire& theWire,
return; return;
} }
// After migration on OCCT version higher than 6.0 #else // After migration on OCCT version, containing PKV's fix. See bug 8293
//BRepLib_MakeFace aBMF; BRepLib_MakeFace aBMF;
//aBMF.Init(theWire, isPlanarWanted, Standard_True); aBMF.Init(theWire, isPlanarWanted, Standard_True);
//if (aBMF.Error() == BRepLib_FaceDone) { if (aBMF.Error() == BRepLib_FaceDone) {
// theResult = aBMF.Shape(); theResult = aBMF.Shape();
// return; return;
//} }
#endif
} }
} }