mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-16 10:54:53 +03:00
0025028: BRepAlgo::ConcatenateWire raises an exception
Test case for issue CR25028
This commit is contained in:
parent
347423b2c2
commit
0272e74033
@ -67,8 +67,8 @@ TopoDS_Wire BRepAlgo::ConcatenateWire(const TopoDS_Wire& W,
|
||||
TopoDS_Edge edge;
|
||||
TopLoc_Location L ;
|
||||
Standard_Real First=0.,Last=0., //extremal values for the curve
|
||||
First0 =0.,
|
||||
toler =0.,
|
||||
First0 = 0.,
|
||||
toler = 0.,
|
||||
tolleft,tolright; //Vertex tolerances
|
||||
TopoDS_Vertex Vfirst,Vlast; //Vertex of the Wire
|
||||
gp_Pnt Pfirst,Plast; //, Pint; corresponding points
|
||||
@ -92,7 +92,7 @@ TopoDS_Wire BRepAlgo::ConcatenateWire(const TopoDS_Wire& W,
|
||||
|
||||
for (index=0 ;index<nb_curve; index++){ //main loop
|
||||
edge = WExp.Current() ;
|
||||
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(edge, L, First, Last);
|
||||
const Handle(Geom_Curve)& aCurve = BRep_Tool::Curve(edge, L, First, Last);
|
||||
Handle(Geom_TrimmedCurve) aTrCurve = new Geom_TrimmedCurve(aCurve, First, Last);
|
||||
tab(index) = GeomConvert::CurveToBSplineCurve(aTrCurve); //storage in a array
|
||||
tab(index)->Transform(L.Transformation());
|
||||
@ -165,61 +165,23 @@ TopoDS_Wire BRepAlgo::ConcatenateWire(const TopoDS_Wire& W,
|
||||
|
||||
}
|
||||
else {
|
||||
TColGeom_Array1OfBSplineCurve tab(0,0); //array of the wire's curve
|
||||
TColStd_Array1OfReal tabtolvertex(0,0); //array of the tolerance's vertex
|
||||
|
||||
WExp.Init(W);
|
||||
|
||||
edge = WExp.Current() ;
|
||||
tab(0) = GeomConvert::CurveToBSplineCurve(new //storage in a array
|
||||
Geom_TrimmedCurve(BRep_Tool::Curve(edge,L,First,Last),First,Last));
|
||||
tab(0)->Transform(L.Transformation());
|
||||
GeomConvert::C0BSplineToC1BSplineCurve(tab(0),Precision::Confusion());
|
||||
const Handle(Geom_Curve)& aC = BRep_Tool::Curve(edge,L,First,Last);
|
||||
Handle(Geom_BSplineCurve) aBS = GeomConvert::CurveToBSplineCurve(new Geom_TrimmedCurve(aC,First,Last));
|
||||
aBS->Transform(L.Transformation());
|
||||
GeomConvert::C0BSplineToC1BSplineCurve(aBS, Precision::Confusion());
|
||||
if (edge.Orientation()==TopAbs_REVERSED)
|
||||
tab(0)->Reverse();
|
||||
tolleft=BRep_Tool::Tolerance(TopExp::LastVertex(edge));
|
||||
tolright=BRep_Tool::Tolerance(TopExp::FirstVertex(edge));
|
||||
tabtolvertex(0)=Max(tolleft,tolright);
|
||||
if(edge.Orientation()==TopAbs_REVERSED){ //(usefull for the closed wire)
|
||||
Vfirst=TopExp::LastVertex(edge);
|
||||
Vlast=TopExp::FirstVertex(edge);
|
||||
}
|
||||
else {
|
||||
|
||||
Vfirst=TopExp::FirstVertex(edge);
|
||||
Vlast = TopExp::LastVertex(edge) ;
|
||||
}
|
||||
Pfirst=BRep_Tool::Pnt(Vfirst);
|
||||
Plast=BRep_Tool::Pnt(Vlast);
|
||||
if ((Pfirst.Distance(Plast)<=toler)&& //C0 continuity test at the closing point
|
||||
(GeomLProp::Continuity(tab(0),tab(0),Last,First,
|
||||
Standard_True,Standard_True,
|
||||
toler, TolAngular)>=GeomAbs_G1))
|
||||
{
|
||||
closed_tolerance =toler; //if ClosedG1!=0 it will be True and
|
||||
closed_flag = Standard_True ;
|
||||
} //with the toler value
|
||||
Handle(TColGeom_HArray1OfBSplineCurve) concatcurve; //array of the concatenated curves
|
||||
Handle(TColStd_HArray1OfInteger) ArrayOfIndices; //array of the remining Vertex
|
||||
if (Option==GeomAbs_G1)
|
||||
GeomConvert::ConcatG1(tab,
|
||||
tabtolvertex,
|
||||
concatcurve,
|
||||
closed_flag,
|
||||
closed_tolerance) ; //G1 concatenation
|
||||
else
|
||||
GeomConvert::ConcatC1(tab,
|
||||
tabtolvertex,
|
||||
ArrayOfIndices,
|
||||
concatcurve,
|
||||
closed_flag,
|
||||
closed_tolerance); //C1 concatenation
|
||||
aBS->Reverse();
|
||||
}
|
||||
|
||||
for (index=0;index<=(concatcurve->Length()-1);index++){ //building of the resulting Wire
|
||||
BRepLib_MakeEdge EdgeBuilder(concatcurve->Value(index));
|
||||
BRepLib_MakeEdge EdgeBuilder(aBS);
|
||||
edge = EdgeBuilder.Edge();
|
||||
MakeResult.Add(edge);
|
||||
}
|
||||
}
|
||||
return MakeResult.Wire() ;
|
||||
|
||||
}
|
||||
@ -271,9 +233,6 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire)
|
||||
ElCLib::AdjustPeriodic
|
||||
(aBasisCurve->FirstParameter(), aBasisCurve->LastParameter(),
|
||||
Precision::PConfusion(), fpar, lpar);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (CurveSeq.IsEmpty()) {
|
||||
|
12
tests/bugs/modalg_5/bug25028
Executable file
12
tests/bugs/modalg_5/bug25028
Executable file
@ -0,0 +1,12 @@
|
||||
puts "============"
|
||||
puts "OCC25028"
|
||||
puts "============"
|
||||
puts ""
|
||||
###############################
|
||||
## BRepAlgo::ConcatenateWire raises an exception
|
||||
###############################
|
||||
|
||||
restore [locate_data_file bug25028_profile.brep] s
|
||||
checkshape s
|
||||
whatis s
|
||||
concatwire r s
|
Loading…
x
Reference in New Issue
Block a user