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;
|
TopoDS_Edge edge;
|
||||||
TopLoc_Location L ;
|
TopLoc_Location L ;
|
||||||
Standard_Real First=0.,Last=0., //extremal values for the curve
|
Standard_Real First=0.,Last=0., //extremal values for the curve
|
||||||
First0 =0.,
|
First0 = 0.,
|
||||||
toler =0.,
|
toler = 0.,
|
||||||
tolleft,tolright; //Vertex tolerances
|
tolleft,tolright; //Vertex tolerances
|
||||||
TopoDS_Vertex Vfirst,Vlast; //Vertex of the Wire
|
TopoDS_Vertex Vfirst,Vlast; //Vertex of the Wire
|
||||||
gp_Pnt Pfirst,Plast; //, Pint; corresponding points
|
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
|
for (index=0 ;index<nb_curve; index++){ //main loop
|
||||||
edge = WExp.Current() ;
|
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);
|
Handle(Geom_TrimmedCurve) aTrCurve = new Geom_TrimmedCurve(aCurve, First, Last);
|
||||||
tab(index) = GeomConvert::CurveToBSplineCurve(aTrCurve); //storage in a array
|
tab(index) = GeomConvert::CurveToBSplineCurve(aTrCurve); //storage in a array
|
||||||
tab(index)->Transform(L.Transformation());
|
tab(index)->Transform(L.Transformation());
|
||||||
@ -165,61 +165,23 @@ TopoDS_Wire BRepAlgo::ConcatenateWire(const TopoDS_Wire& W,
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
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);
|
WExp.Init(W);
|
||||||
|
|
||||||
edge = WExp.Current() ;
|
edge = WExp.Current() ;
|
||||||
tab(0) = GeomConvert::CurveToBSplineCurve(new //storage in a array
|
const Handle(Geom_Curve)& aC = BRep_Tool::Curve(edge,L,First,Last);
|
||||||
Geom_TrimmedCurve(BRep_Tool::Curve(edge,L,First,Last),First,Last));
|
Handle(Geom_BSplineCurve) aBS = GeomConvert::CurveToBSplineCurve(new Geom_TrimmedCurve(aC,First,Last));
|
||||||
tab(0)->Transform(L.Transformation());
|
aBS->Transform(L.Transformation());
|
||||||
GeomConvert::C0BSplineToC1BSplineCurve(tab(0),Precision::Confusion());
|
GeomConvert::C0BSplineToC1BSplineCurve(aBS, Precision::Confusion());
|
||||||
if (edge.Orientation()==TopAbs_REVERSED)
|
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
|
aBS->Reverse();
|
||||||
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
|
|
||||||
|
|
||||||
for (index=0;index<=(concatcurve->Length()-1);index++){ //building of the resulting Wire
|
BRepLib_MakeEdge EdgeBuilder(aBS);
|
||||||
BRepLib_MakeEdge EdgeBuilder(concatcurve->Value(index));
|
|
||||||
edge = EdgeBuilder.Edge();
|
edge = EdgeBuilder.Edge();
|
||||||
MakeResult.Add(edge);
|
MakeResult.Add(edge);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return MakeResult.Wire() ;
|
return MakeResult.Wire() ;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -271,9 +233,6 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire)
|
|||||||
ElCLib::AdjustPeriodic
|
ElCLib::AdjustPeriodic
|
||||||
(aBasisCurve->FirstParameter(), aBasisCurve->LastParameter(),
|
(aBasisCurve->FirstParameter(), aBasisCurve->LastParameter(),
|
||||||
Precision::PConfusion(), fpar, lpar);
|
Precision::PConfusion(), fpar, lpar);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurveSeq.IsEmpty()) {
|
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