1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00

0024964: ThruSections crashes the DRAW.exe

Test case for issue CR24964
This commit is contained in:
jgv
2014-06-19 13:27:27 +04:00
committed by apn
parent 9bdafcbe2d
commit e01907f12a
2 changed files with 189 additions and 158 deletions

View File

@@ -239,7 +239,7 @@ static TopoDS_Solid MakeSolid(TopoDS_Shell& shell, const TopoDS_Wire& wire1,
BB.MakeSolid(solid);
TopoDS_Shape aLocalShape = shell.Reversed();
BB.Add(solid, TopoDS::Shell(aLocalShape));
// B.Add(solid, TopoDS::Shell(newShell.Reversed()));
// B.Add(solid, TopoDS::Shell(newShell.Reversed()));
}
solid.Closed(Standard_True);
@@ -254,10 +254,10 @@ static TopoDS_Solid MakeSolid(TopoDS_Shell& shell, const TopoDS_Wire& wire1,
BRepOffsetAPI_ThruSections::BRepOffsetAPI_ThruSections(const Standard_Boolean isSolid, const Standard_Boolean ruled,
const Standard_Real pres3d):
myIsSolid(isSolid), myIsRuled(ruled), myPres3d(pres3d)
myIsSolid(isSolid), myIsRuled(ruled), myPres3d(pres3d)
{
myWCheck = Standard_True;
//----------------------------
//----------------------------
myParamType = Approx_ChordLength;
myDegMax = 8;
myContinuity = GeomAbs_C2;
@@ -280,7 +280,7 @@ void BRepOffsetAPI_ThruSections::Init(const Standard_Boolean isSolid, const Stan
myIsRuled = ruled;
myPres3d = pres3d;
myWCheck = Standard_True;
//----------------------------
//----------------------------
myParamType = Approx_ChordLength;
myDegMax = 6;
myContinuity = GeomAbs_C2;
@@ -415,7 +415,7 @@ void BRepOffsetAPI_ThruSections::CreateRuled()
{
Standard_Integer nbSects = myWires.Length();
BRepFill_Generator aGene;
// for (Standard_Integer i=1; i<=nbSects; i++) {
// for (Standard_Integer i=1; i<=nbSects; i++) {
Standard_Integer i;
for (i=1; i<=nbSects; i++) {
aGene.AddWire(TopoDS::Wire(myWires(i)));
@@ -442,7 +442,7 @@ void BRepOffsetAPI_ThruSections::CreateRuled()
B.MakeSolid(solid);
TopoDS_Shape aLocalShape = shell.Reversed();
B.Add(solid, TopoDS::Shell(aLocalShape));
// B.Add(solid, TopoDS::Shell(shell.Reversed()));
// B.Add(solid, TopoDS::Shell(shell.Reversed()));
}
myShape = solid;
@@ -677,7 +677,7 @@ void BRepOffsetAPI_ThruSections::CreateSmoothed()
// copy the degenerated edge
TopoDS_Shape aLocalShape = shapes(1).EmptyCopied();
edge1 = TopoDS::Edge(aLocalShape);
// edge1 = TopoDS::Edge(shapes(1).EmptyCopied());
// edge1 = TopoDS::Edge(shapes(1).EmptyCopied());
edge1.Orientation(TopAbs_FORWARD);
}
else {
@@ -702,7 +702,7 @@ void BRepOffsetAPI_ThruSections::CreateSmoothed()
// copy of the degenerated edge
TopoDS_Shape aLocalShape = shapes(nbSects*nbEdges).EmptyCopied();
edge2 = TopoDS::Edge(aLocalShape);
// edge2 = TopoDS::Edge(shapes(nbSects*nbEdges).EmptyCopied());
// edge2 = TopoDS::Edge(shapes(nbSects*nbEdges).EmptyCopied());
edge2.Orientation(TopAbs_FORWARD);
}
else {
@@ -819,7 +819,7 @@ void BRepOffsetAPI_ThruSections::CreateSmoothed()
B.MakeSolid(solid);
TopoDS_Shape aLocalShape = shell.Reversed();
B.Add(solid, TopoDS::Shell(aLocalShape));
// B.Add(solid, TopoDS::Shell(shell.Reversed()));
// B.Add(solid, TopoDS::Shell(shell.Reversed()));
}
myShape = solid;
@@ -932,7 +932,6 @@ Handle(Geom_BSplineSurface) BRepOffsetAPI_ThruSections::
const Standard_Boolean vClosed) const
{
Standard_Integer i,j,jdeb=1,jfin=NbSects;
TopoDS_Edge edge;
TopoDS_Vertex vf,vl;
GeomFill_SectionGenerator section;
@@ -943,7 +942,7 @@ Handle(Geom_BSplineSurface) BRepOffsetAPI_ThruSections::
if (w1Point) {
jdeb++;
edge = TopoDS::Edge(shapes(1));
TopoDS_Edge edge = TopoDS::Edge(shapes(1));
TopExp::Vertices(edge,vl,vf);
TColgp_Array1OfPnt Extremities(1,2);
Extremities(1) = BRep_Tool::Pnt(vf);
@@ -981,10 +980,15 @@ Handle(Geom_BSplineSurface) BRepOffsetAPI_ThruSections::
for (i=2; i<=NbEdges; i++) {
// read the edge
TopoDS_Edge aNextEdge = TopoDS::Edge (shapes((j-1)*NbEdges+i));
Standard_Real aTolV = Precision::Confusion();
TopExp::Vertices(aNextEdge,vf,vl);
aTolV = Max(aTolV, BRep_Tool::Tolerance(vf));
aTolV = Max(aTolV, BRep_Tool::Tolerance(vl));
aTolV = Min(aTolV, 1.e-3);
curvBS = EdgeToBSpline (aNextEdge);
// concatenation
CompBS.Add(curvBS, Precision::Confusion(), Standard_True, Standard_False, 1);
CompBS.Add(curvBS, aTolV, Standard_True, Standard_False, 1);
}
// return the final section
@@ -1000,7 +1004,7 @@ Handle(Geom_BSplineSurface) BRepOffsetAPI_ThruSections::
}
if (w2Point) {
edge = TopoDS::Edge(shapes(NbSects*NbEdges));
TopoDS_Edge edge = TopoDS::Edge(shapes(NbSects*NbEdges));
TopExp::Vertices(edge,vl,vf);
TColgp_Array1OfPnt Extremities(1,2);
Extremities(1) = BRep_Tool::Pnt(vf);

View File

@@ -0,0 +1,27 @@
puts "============"
puts "OCC24964"
puts "============"
puts ""
#########################################################################
# ThruSections crashes the DRAW.exe
#########################################################################
restore [locate_data_file bug24964_w1.brep] w1
restore [locate_data_file bug24964_w2.brep] w2
restore [locate_data_file bug24964_w3.brep] w3
thrusections result 0 0 w1 w2 w3
set square 163127
set nb_v_good 30
set nb_e_good 45
set nb_w_good 15
set nb_f_good 15
set nb_sh_good 1
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 0
set nb_shape_good 106
set 2dviewer 1