Bug 0020228: [CEA 331] the geompy.RemoveExtraEdges crash with the attached brep shape file.

This commit is contained in:
jfa 2009-04-03 08:22:54 +00:00
parent 7cb3d2610b
commit ad5a032fcc

View File

@ -22,7 +22,7 @@
// File: BlockFix_UnionEdges.cxx
// Created: 07.12.04 15:27:30
// Author: Sergey KUUL
//
#include <BlockFix_UnionEdges.ixx>
#include <Approx_Curve3d.hxx>
@ -179,17 +179,29 @@ static Standard_Boolean MergeEdges(const TopTools_SequenceOfShape& SeqEdges,
gp_Pnt PVM = BRep_Tool::Pnt(VM);
GC_MakeCircle MC (PV1,PVM,PV2);
Handle(Geom_Circle) C = MC.Value();
TopoDS_Edge E;
if (!MC.IsDone() || C.IsNull()) {
// jfa for Mantis issue 0020228
if (PV1.Distance(PV2) > Precision::Confusion()) continue;
// closed chain
C = C1;
B.MakeEdge (E,C,Precision::Confusion());
B.Add(E,V1);
B.Add(E,V2);
}
else {
gp_Pnt P0 = C->Location();
gp_Dir D1(gp_Vec(P0,PV1));
gp_Dir D2(gp_Vec(P0,PV2));
Standard_Real fpar = C->XAxis().Direction().Angle(D1);
Standard_Real lpar = C->XAxis().Direction().Angle(D2);
Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(C,fpar,lpar);
TopoDS_Edge E;
B.MakeEdge (E,tc,Precision::Confusion());
B.Add (E,V1); B.Add (E,V2);
B.Add(E,V1);
B.Add(E,V2);
B.UpdateVertex(V1, fpar, E, 0.);
B.UpdateVertex(V2, lpar, E, 0.);
}
ShapeFix_Edge sfe;
sfe.FixAddPCurve(E,aFace,Standard_False);
sfe.FixSameParameter(E);