mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0028529: UnifySameDomain crashes on a shape with location
During gluing edges, when getting pcurve of an edge, consider the proper surface location.
This commit is contained in:
parent
030ba6489b
commit
fbfdf61abb
@ -520,24 +520,21 @@ static TopoDS_Edge GlueEdgesWithPCurves(const TopTools_SequenceOfShape& aChain,
|
|||||||
Standard_Integer i, j;
|
Standard_Integer i, j;
|
||||||
|
|
||||||
TopoDS_Edge FirstEdge = TopoDS::Edge(aChain(1));
|
TopoDS_Edge FirstEdge = TopoDS::Edge(aChain(1));
|
||||||
//TColGeom2d_SequenceOfCurve PCurveSeq;
|
|
||||||
TColGeom_SequenceOfSurface SurfSeq;
|
TColGeom_SequenceOfSurface SurfSeq;
|
||||||
//TopTools_SequenceOfShape LocSeq;
|
NCollection_Sequence<TopLoc_Location> LocSeq;
|
||||||
|
|
||||||
BRep_ListIteratorOfListOfCurveRepresentation itr( (Handle(BRep_TEdge)::DownCast(FirstEdge.TShape()))->Curves() );
|
for (int aCurveIndex = 0;; aCurveIndex++)
|
||||||
for (; itr.More(); itr.Next())
|
|
||||||
{
|
{
|
||||||
Handle(BRep_CurveRepresentation) CurveRep = itr.Value();
|
Handle(Geom2d_Curve) aCurve;
|
||||||
if (CurveRep->IsCurveOnSurface())
|
Handle(Geom_Surface) aSurface;
|
||||||
{
|
TopLoc_Location aLocation;
|
||||||
//PCurveSeq.Append(CurveRep->PCurve());
|
Standard_Real aFirst, aLast;
|
||||||
SurfSeq.Append(CurveRep->Surface());
|
BRep_Tool::CurveOnSurface (FirstEdge, aCurve, aSurface, aLocation, aFirst, aLast, aCurveIndex);
|
||||||
/*
|
if (aCurve.IsNull())
|
||||||
TopoDS_Shape aLocShape;
|
break;
|
||||||
aLocShape.Location(CurveRep->Location());
|
|
||||||
LocSeq.Append(aLocShape);
|
SurfSeq.Append(aSurface);
|
||||||
*/
|
LocSeq.Append(aLocation);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Real fpar, lpar;
|
Standard_Real fpar, lpar;
|
||||||
@ -605,14 +602,12 @@ static TopoDS_Edge GlueEdgesWithPCurves(const TopTools_SequenceOfShape& aChain,
|
|||||||
Handle(Geom_BSplineCurve) ResCurve = concatcurve->Value(concatcurve->Lower());
|
Handle(Geom_BSplineCurve) ResCurve = concatcurve->Value(concatcurve->Lower());
|
||||||
|
|
||||||
TColGeom2d_SequenceOfBoundedCurve ResPCurves;
|
TColGeom2d_SequenceOfBoundedCurve ResPCurves;
|
||||||
TopLoc_Location aLoc;
|
|
||||||
for (j = 1; j <= SurfSeq.Length(); j++)
|
for (j = 1; j <= SurfSeq.Length(); j++)
|
||||||
{
|
{
|
||||||
TColGeom2d_Array1OfBSplineCurve tab_c2d(0,nb_curve-1); //array of the pcurves
|
TColGeom2d_Array1OfBSplineCurve tab_c2d(0,nb_curve-1); //array of the pcurves
|
||||||
|
|
||||||
PrevVertex = FirstVertex;
|
PrevVertex = FirstVertex;
|
||||||
PrevEdge = FirstEdge;
|
PrevEdge = FirstEdge;
|
||||||
//TopLoc_Location theLoc = LocSeq(j).Location();
|
|
||||||
for (i = 1; i <= nb_curve; i++)
|
for (i = 1; i <= nb_curve; i++)
|
||||||
{
|
{
|
||||||
TopoDS_Edge anEdge = TopoDS::Edge(aChain(i));
|
TopoDS_Edge anEdge = TopoDS::Edge(aChain(i));
|
||||||
@ -620,12 +615,10 @@ static TopoDS_Edge GlueEdgesWithPCurves(const TopTools_SequenceOfShape& aChain,
|
|||||||
TopExp::Vertices(anEdge, VF, VL);
|
TopExp::Vertices(anEdge, VF, VL);
|
||||||
Standard_Boolean ToReverse = (!VF.IsSame(PrevVertex));
|
Standard_Boolean ToReverse = (!VF.IsSame(PrevVertex));
|
||||||
|
|
||||||
/*
|
|
||||||
Handle(Geom2d_Curve) aPCurve =
|
Handle(Geom2d_Curve) aPCurve =
|
||||||
BRep_Tool::CurveOnSurface(anEdge, SurfSeq(j), anEdge.Location()*theLoc, fpar, lpar);
|
BRep_Tool::CurveOnSurface(anEdge, SurfSeq(j), LocSeq(j), fpar, lpar);
|
||||||
*/
|
if (aPCurve.IsNull())
|
||||||
Handle(Geom2d_Curve) aPCurve =
|
continue;
|
||||||
BRep_Tool::CurveOnSurface(anEdge, SurfSeq(j), aLoc, fpar, lpar);
|
|
||||||
Handle(Geom2d_TrimmedCurve) aTrPCurve = new Geom2d_TrimmedCurve(aPCurve, fpar, lpar);
|
Handle(Geom2d_TrimmedCurve) aTrPCurve = new Geom2d_TrimmedCurve(aPCurve, fpar, lpar);
|
||||||
tab_c2d(i-1) = Geom2dConvert::CurveToBSplineCurve(aTrPCurve);
|
tab_c2d(i-1) = Geom2dConvert::CurveToBSplineCurve(aTrPCurve);
|
||||||
Geom2dConvert::C0BSplineToC1BSplineCurve(tab_c2d(i-1), Precision::Confusion());
|
Geom2dConvert::C0BSplineToC1BSplineCurve(tab_c2d(i-1), Precision::Confusion());
|
||||||
@ -663,8 +656,8 @@ static TopoDS_Edge GlueEdgesWithPCurves(const TopTools_SequenceOfShape& aChain,
|
|||||||
BB.SameParameter(ResEdge, Standard_False);
|
BB.SameParameter(ResEdge, Standard_False);
|
||||||
for (j = 1; j <= ResPCurves.Length(); j++)
|
for (j = 1; j <= ResPCurves.Length(); j++)
|
||||||
{
|
{
|
||||||
BB.UpdateEdge(ResEdge, ResPCurves(j), SurfSeq(j), aLoc, MaxTol);
|
BB.UpdateEdge(ResEdge, ResPCurves(j), SurfSeq(j), LocSeq(j), MaxTol);
|
||||||
BB.Range(ResEdge, SurfSeq(j), aLoc, ResPCurves(j)->FirstParameter(), ResPCurves(j)->LastParameter());
|
BB.Range(ResEdge, SurfSeq(j), LocSeq(j), ResPCurves(j)->FirstParameter(), ResPCurves(j)->LastParameter());
|
||||||
}
|
}
|
||||||
|
|
||||||
BRepLib::SameParameter(ResEdge, MaxTol, Standard_True);
|
BRepLib::SameParameter(ResEdge, MaxTol, Standard_True);
|
||||||
|
12
tests/bugs/heal/bug28529
Normal file
12
tests/bugs/heal/bug28529
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
puts "=========="
|
||||||
|
puts "OCC28529"
|
||||||
|
puts "=========="
|
||||||
|
puts ""
|
||||||
|
######################################################################################################################
|
||||||
|
# UnifySameDomain crashes on a shape with location
|
||||||
|
######################################################################################################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug28529_face_to_unify.brep] a
|
||||||
|
|
||||||
|
unifysamedom result a +b
|
||||||
|
checknbshapes result -m UnifySameDomain -edge 143 -vertex 143
|
Loading…
x
Reference in New Issue
Block a user