1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-05-06 10:36:12 +03:00

Fix for operation "Split shell"

This commit is contained in:
gka 2014-10-21 15:13:54 +04:00
parent d099845895
commit a5a0a4399f
4 changed files with 110 additions and 83 deletions

View File

@ -76,6 +76,7 @@ is
Add(me: in out; W: Wire from TopoDS; Add(me: in out; W: Wire from TopoDS;
F: Face from TopoDS) F: Face from TopoDS)
returns Boolean from Standard
---Purpose: Adds the wire <W> on the face <F>. ---Purpose: Adds the wire <W> on the face <F>.
raises NoSuchObject from Standard, raises NoSuchObject from Standard,
-- if <F> does not belong to the original shape. -- if <F> does not belong to the original shape.
@ -88,6 +89,7 @@ is
Add(me: in out; Lwires: ListOfShape from TopTools; Add(me: in out; Lwires: ListOfShape from TopTools;
F: Face from TopoDS) F: Face from TopoDS)
returns Boolean from Standard
---Purpose: Adds the list of wires <Lwires> on the face <F>. ---Purpose: Adds the list of wires <Lwires> on the face <F>.
raises NoSuchObject from Standard, raises NoSuchObject from Standard,
-- if <F> does not belong to the original shape. -- if <F> does not belong to the original shape.
@ -131,11 +133,11 @@ is
-- -- Private implementation methods -- -- Private implementation methods
AddOpenWire(me: in out; W: Wire from TopoDS; F: Face from TopoDS) AddOpenWire(me: in out; W: Wire from TopoDS; F: Face from TopoDS)
returns Boolean from Standard
is static private; is static private;
AddClosedWire(me: in out; W: Wire from TopoDS; F: Face from TopoDS) AddClosedWire(me: in out; W: Wire from TopoDS; F: Face from TopoDS) returns Boolean from Standard
is static private; is static private;

View File

@ -60,8 +60,9 @@ static Standard_Boolean IsInside(const TopoDS_Face&,
static Standard_Boolean IsInside(const TopoDS_Face&, static Standard_Boolean IsInside(const TopoDS_Face&,
const TopoDS_Wire&); const TopoDS_Wire&);
static void ChoixUV(const TopoDS_Edge&, static Standard_Boolean ChoixUV(const TopoDS_Edge&,
const TopoDS_Face&, const TopoDS_Face&,
const TopoDS_Vertex&,
const TopTools_MapOfShape&, const TopTools_MapOfShape&,
TopTools_MapIteratorOfMapOfShape&, TopTools_MapIteratorOfMapOfShape&,
gp_Pnt2d&, gp_Pnt2d&,
@ -231,7 +232,7 @@ void LocOpe_SplitShape::Add(const TopoDS_Vertex& V,
//purpose : adds the list of wires on the face <F> //purpose : adds the list of wires on the face <F>
//======================================================================= //=======================================================================
void LocOpe_SplitShape::Add(const TopTools_ListOfShape& Lwires, Standard_Boolean LocOpe_SplitShape::Add(const TopTools_ListOfShape& Lwires,
const TopoDS_Face& F) const TopoDS_Face& F)
{ {
@ -250,26 +251,27 @@ void LocOpe_SplitShape::Add(const TopTools_ListOfShape& Lwires,
TopoDS_Vertex Vfirst,Vlast; TopoDS_Vertex Vfirst,Vlast;
BRepTools::Update(F); BRepTools::Update(F);
// Standard_Boolean nbInside = 0;
TopTools_ListOfShape aLInside;
for (; itl.More(); itl.Next()) for (; itl.More(); itl.Next())
{ {
const TopoDS_Face& fac = TopoDS::Face(itl.Value()); const TopoDS_Face& fac = TopoDS::Face(itl.Value());
Standard_Boolean AllWiresInside = Standard_True; //Standard_Boolean AllWiresInside = Standard_True;
TopTools_ListIteratorOfListOfShape itwires(Lwires); TopTools_ListIteratorOfListOfShape itwires(Lwires);
for (; itwires.More(); itwires.Next()) for (; itwires.More(); itwires.Next())
{ {
const TopoDS_Wire& aWire = TopoDS::Wire(itwires.Value()); const TopoDS_Wire& aWire = TopoDS::Wire(itwires.Value());
if (!IsInside(fac, aWire)) if (IsInside(fac, aWire))
{ {
AllWiresInside = Standard_False; //nbInside++;
break; aLInside.Append(aWire);
} }
} }
if (AllWiresInside)
break;
} }
if (!itl.More()) { if (!aLInside.Extent()) {
Standard_ConstructionError::Raise(); return Standard_False;
} }
TopoDS_Face FaceRef = TopoDS::Face(itl.Value()); TopoDS_Face FaceRef = TopoDS::Face(itl.Value());
@ -288,7 +290,7 @@ void LocOpe_SplitShape::Add(const TopTools_ListOfShape& Lwires,
TopTools_DataMapOfShapeShape VerWireMap; TopTools_DataMapOfShapeShape VerWireMap;
Standard_Integer i; Standard_Integer i;
TopExp_Explorer ExploF, ExploW; TopExp_Explorer ExploF, ExploW;
for (itl.Initialize(Lwires); itl.More(); itl.Next()) for (itl.Initialize(aLInside); itl.More(); itl.Next())
{ {
const TopoDS_Wire& aSection = TopoDS::Wire(itl.Value()); const TopoDS_Wire& aSection = TopoDS::Wire(itl.Value());
TopoDS_Vertex Ver [2]; TopoDS_Vertex Ver [2];
@ -317,7 +319,7 @@ void LocOpe_SplitShape::Add(const TopTools_ListOfShape& Lwires,
} }
TopTools_DataMapOfShapeListOfShape VerSecMap; TopTools_DataMapOfShapeListOfShape VerSecMap;
for (itl.Initialize(Lwires); itl.More(); itl.Next()) for (itl.Initialize(aLInside); itl.More(); itl.Next())
{ {
const TopoDS_Wire& aWire = TopoDS::Wire(itl.Value()); const TopoDS_Wire& aWire = TopoDS::Wire(itl.Value());
TopoDS_Vertex V1, V2; TopoDS_Vertex V1, V2;
@ -514,7 +516,7 @@ void LocOpe_SplitShape::Add(const TopTools_ListOfShape& Lwires,
/////////////////// ///////////////////
// JAG 10.11.95 Codage des regularites // JAG 10.11.95 Codage des regularites
for (itl.Initialize(Lwires); itl.More(); itl.Next()) for (itl.Initialize(aLInside); itl.More(); itl.Next())
for (ExploW.Init(itl.Value(), TopAbs_EDGE); ExploW.More(); ExploW.Next()) for (ExploW.Init(itl.Value(), TopAbs_EDGE); ExploW.More(); ExploW.Next())
{ {
const TopoDS_Edge& edg = TopoDS::Edge(ExploW.Current()); const TopoDS_Edge& edg = TopoDS::Edge(ExploW.Current());
@ -522,6 +524,7 @@ void LocOpe_SplitShape::Add(const TopTools_ListOfShape& Lwires,
BB.Continuity(edg,F,F,GeomAbs_CN); BB.Continuity(edg,F,F,GeomAbs_CN);
} }
} }
return Standard_True;
} }
@ -530,12 +533,13 @@ void LocOpe_SplitShape::Add(const TopTools_ListOfShape& Lwires,
//purpose : //purpose :
//======================================================================= //=======================================================================
void LocOpe_SplitShape::Add(const TopoDS_Wire& W, Standard_Boolean LocOpe_SplitShape::Add(const TopoDS_Wire& W,
const TopoDS_Face& F) const TopoDS_Face& F)
{ {
if (myDone) { if (myDone) {
Standard_ConstructionError::Raise(); return Standard_False;
//Standard_ConstructionError::Raise();
} }
@ -547,16 +551,18 @@ void LocOpe_SplitShape::Add(const TopoDS_Wire& W,
try { try {
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
if (!LocOpe::Closed(W,F)) { if (!LocOpe::Closed(W,F)) {
AddOpenWire(W,F); if(!AddOpenWire(W,F))
return Standard_False;
} }
else { else {
AddClosedWire(W,F); if(!AddClosedWire(W,F))
return Standard_False;
} }
} catch (Standard_Failure ) { } catch (Standard_Failure ) {
#ifdef DEB #ifdef DEB
cout << "Warning: SpliShape internal problem detected, some faces may be lost. Check input edges/wires" <<endl; cout << "Warning: SpliShape internal problem detected, some faces may be lost. Check input edges/wires" <<endl;
#endif #endif
return; return Standard_False;
} }
// JAG 10.11.95 Codage des regularites // JAG 10.11.95 Codage des regularites
BRep_Builder B; BRep_Builder B;
@ -566,16 +572,16 @@ void LocOpe_SplitShape::Add(const TopoDS_Wire& W,
B.Continuity(edg,F,F,GeomAbs_CN); B.Continuity(edg,F,F,GeomAbs_CN);
} }
} }
return Standard_True;
} }
//======================================================================= //=======================================================================
//function : AddClosedWire //function : AddClosedWire
//purpose : //purpose :
//======================================================================= //=======================================================================
void LocOpe_SplitShape::AddClosedWire(const TopoDS_Wire& W, Standard_Boolean LocOpe_SplitShape::AddClosedWire(const TopoDS_Wire& W,
const TopoDS_Face& F) const TopoDS_Face& F)
{ {
TopExp_Explorer exp; TopExp_Explorer exp;
@ -598,7 +604,8 @@ void LocOpe_SplitShape::AddClosedWire(const TopoDS_Wire& W,
} }
if (!itl.More()) { if (!itl.More()) {
Standard_ConstructionError::Raise(); return Standard_False;
//Standard_ConstructionError::Raise();
} }
BRep_Builder B; BRep_Builder B;
@ -648,7 +655,7 @@ void LocOpe_SplitShape::AddClosedWire(const TopoDS_Wire& W,
B.Add(newRef,W.Oriented(TopAbs::Reverse(orWire))); B.Add(newRef,W.Oriented(TopAbs::Reverse(orWire)));
lf.Append(newRef); lf.Append(newRef);
lf.Append(newFace); lf.Append(newFace);
return Standard_True;
} }
@ -657,7 +664,7 @@ void LocOpe_SplitShape::AddClosedWire(const TopoDS_Wire& W,
//purpose : //purpose :
//======================================================================= //=======================================================================
void LocOpe_SplitShape::AddOpenWire(const TopoDS_Wire& W, Standard_Boolean LocOpe_SplitShape::AddOpenWire(const TopoDS_Wire& W,
const TopoDS_Face& F) const TopoDS_Face& F)
{ {
@ -716,7 +723,8 @@ void LocOpe_SplitShape::AddOpenWire(const TopoDS_Wire& W,
} }
} }
if (!itl.More()) { if (!itl.More()) {
Standard_ConstructionError::Raise(); return Standard_False;
//Standard_ConstructionError::Raise();
} }
TopoDS_Face FaceRef = TopoDS::Face(itl.Value()); TopoDS_Face FaceRef = TopoDS::Face(itl.Value());
@ -819,19 +827,19 @@ void LocOpe_SplitShape::AddOpenWire(const TopoDS_Wire& W,
if (LastEdge.Orientation() == TopAbs_FORWARD) { if (LastEdge.Orientation() == TopAbs_FORWARD) {
C2d->D1(l,plast,dlast); C2d->D1(l,plast,dlast);
if (dlast.Magnitude() < gp::Resolution()) //if (dlast.Magnitude() < gp::Resolution())
{ //{
gp_Pnt2d PrevPnt = C2d->Value(l - dpar); gp_Pnt2d PrevPnt = C2d->Value(l - dpar);
dlast.SetXY(plast.XY() - PrevPnt.XY()); dlast.SetXY(plast.XY() - PrevPnt.XY());
} //}
} }
else { else {
C2d->D1(f,plast,dlast); C2d->D1(f,plast,dlast);
if (dlast.Magnitude() < gp::Resolution()) //if (dlast.Magnitude() < gp::Resolution())
{ //{
gp_Pnt2d NextPnt = C2d->Value(f + dpar); gp_Pnt2d NextPnt = C2d->Value(f + dpar);
dlast.SetXY(NextPnt.XY() - plast.XY()); dlast.SetXY(NextPnt.XY() - plast.XY());
} //}
dlast.Reverse(); dlast.Reverse();
} }
@ -877,30 +885,30 @@ void LocOpe_SplitShape::AddOpenWire(const TopoDS_Wire& W,
if (itm.Key().Orientation() == TopAbs_FORWARD) { if (itm.Key().Orientation() == TopAbs_FORWARD) {
C2d->D1(l,plast,dlast); C2d->D1(l,plast,dlast);
if (dlast.Magnitude() < gp::Resolution()) //if (dlast.Magnitude() < gp::Resolution())
{ //{
gp_Pnt2d PrevPnt = C2d->Value(l - dpar); gp_Pnt2d PrevPnt = C2d->Value(l - dpar);
dlast.SetXY(plast.XY() - PrevPnt.XY()); dlast.SetXY(plast.XY() - PrevPnt.XY());
} //}
} }
else { else {
C2d->D1(f,plast,dlast); C2d->D1(f,plast,dlast);
if (dlast.Magnitude() < gp::Resolution()) //if (dlast.Magnitude() < gp::Resolution())
{ //{
gp_Pnt2d NextPnt = C2d->Value(f + dpar); gp_Pnt2d NextPnt = C2d->Value(f + dpar);
dlast.SetXY(NextPnt.XY() - plast.XY()); dlast.SetXY(NextPnt.XY() - plast.XY());
} //}
dlast.Reverse(); dlast.Reverse();
} }
} }
else if (nbPoss > 1) { else if (nbPoss > 1) {
// Faire choix en U,V... // Faire choix en U,V...
TopoDS_Shape aLocalFace = FaceRef.Oriented(wfirst.Orientation()); TopoDS_Shape aLocalFace = FaceRef.Oriented(wfirst.Orientation());
ChoixUV(LastEdge, TopoDS::Face(aLocalFace), PossE, //ChoixUV(LastEdge, TopoDS::Face(aLocalFace), PossE,
itm, plast, dlast, toll); // itm, plast, dlast, toll);
/*if(!ChoixUV(LastEdge, TopoDS::Face(aLocalFace), PossE, if(!ChoixUV(LastEdge, TopoDS::Face(aLocalFace), Vlast, PossE,
itm, plast, dlast, toll)) itm, plast, dlast, toll))
return;*/ return Standard_False;
} }
@ -1090,6 +1098,7 @@ void LocOpe_SplitShape::AddOpenWire(const TopoDS_Wire& W,
} }
} }
return Standard_True;
} }
@ -1369,8 +1378,9 @@ static Standard_Boolean IsInside(const TopoDS_Face& F,
//purpose : //purpose :
//======================================================================= //=======================================================================
void ChoixUV(const TopoDS_Edge& Last, Standard_Boolean ChoixUV(const TopoDS_Edge& Last,
const TopoDS_Face& F, const TopoDS_Face& F,
const TopoDS_Vertex& theVCommon,
const TopTools_MapOfShape& Poss, const TopTools_MapOfShape& Poss,
TopTools_MapIteratorOfMapOfShape& It, TopTools_MapIteratorOfMapOfShape& It,
gp_Pnt2d& plst, gp_Pnt2d& plst,
@ -1386,48 +1396,49 @@ void ChoixUV(const TopoDS_Edge& Last,
BRepAdaptor_Surface surf(F,Standard_False); // no restriction BRepAdaptor_Surface surf(F,Standard_False); // no restriction
surf.D0 (plst.X(), plst.Y(), aPlst); surf.D0 (plst.X(), plst.Y(), aPlst);
Standard_Real tol; Standard_Real tolV = BRep_Tool::Tolerance(theVCommon) + Precision::Confusion();
TopoDS_Vertex vtx; TopoDS_Vertex vtx;
gp_Dir2d ref2d(dlst); gp_Dir2d ref2d(dlst);
gp_XY aNext2d(0.,0.0);
Handle(Geom2d_Curve) C2d; Handle(Geom2d_Curve) C2d;
Standard_Real dpar; Standard_Real dpar;
Standard_Integer index = 0, imin=0; Standard_Integer index = 0, imin=0;
Standard_Real angmax = -M_PI, dist, ang; Standard_Real angmax = -M_PI, dist, ang;
Standard_Real dmin = Precision::Infinite();
Standard_Real aTol = Max (surf.UResolution (tolV), surf.VResolution (tolV));
for (It.Initialize(Poss); It.More(); It.Next()) { for (It.Initialize(Poss); It.More(); It.Next()) {
index++; index++;
C2d = BRep_Tool::CurveOnSurface(TopoDS::Edge(It.Key()),F,f,l); C2d = BRep_Tool::CurveOnSurface(TopoDS::Edge(It.Key()),F,f,l);
dpar = (l - f)*0.01; dpar = Min(aTol,(l - f)*0.01);
if (It.Key().Orientation() == TopAbs_FORWARD) { if (It.Key().Orientation() == TopAbs_FORWARD) {
// p2d = C2d->Value(f); p2d = C2d->Value(f);
C2d->D1(f,p2d,v2d); //C2d->D1(f,p2d,v2d);
if (v2d.Magnitude() < gp::Resolution()) //if (v2d.Magnitude() < gp::Resolution())
{ //{
gp_Pnt2d NextPnt = C2d->Value(f + dpar); gp_Pnt2d NextPnt = C2d->Value(f + dpar);
v2d.SetXY(NextPnt.XY() - p2d.XY()); v2d.SetXY(NextPnt.XY() - p2d.XY());
} //}
vtx = TopExp::FirstVertex(TopoDS::Edge(It.Key())); vtx = TopExp::FirstVertex(TopoDS::Edge(It.Key()));
} }
else { else {
// p2d = C2d->Value(l); p2d = C2d->Value(l);
C2d->D1(l,p2d,v2d); C2d->D1(l,p2d,v2d);
if (v2d.Magnitude() < gp::Resolution()) // if (v2d.Magnitude() < gp::Resolution())
{ // {
gp_Pnt2d PrevPnt = C2d->Value(l - dpar); gp_Pnt2d PrevPnt = C2d->Value(l - dpar);
v2d.SetXY(p2d.XY() - PrevPnt.XY()); v2d.SetXY(p2d.XY() - PrevPnt.XY());
} // }
v2d.Reverse(); v2d.Reverse();
vtx = TopExp::LastVertex(TopoDS::Edge(It.Key())); vtx = TopExp::LastVertex(TopoDS::Edge(It.Key()));
} }
surf.D0 (p2d.X(), p2d.Y(), aPCur); surf.D0 (p2d.X(), p2d.Y(), aPCur);
tol = BRep_Tool::Tolerance(vtx); Standard_Real tol = BRep_Tool::Tolerance(vtx);
tol = Max(toll, tol); tol *= tol; tol = Max(toll, tol); tol *= tol;
dist = aPCur.SquareDistance(aPlst); dist = aPCur.SquareDistance(aPlst);
@ -1439,44 +1450,49 @@ void ChoixUV(const TopoDS_Edge& Last,
ang = -M_PI; ang = -M_PI;
} }
//if ((dist < dmin - tol) || if ((dist < tol) && (ang > angmax)) {// && !Last.IsSame(It.Key())) {
//(dist <= dmin+tol && ang > angmax)) {
if ((dist < tol) && (ang > angmax)) {
//if (ang > angmax) {
imin = index; imin = index;
// dmin = dist;
angmax = ang; angmax = ang;
dmin = dist;
} }
} }
if(!imin)
return Standard_False;
for (index = 1, It.Initialize(Poss); It.More(); It.Next()) { for (index = 1, It.Initialize(Poss); It.More(); It.Next()) {
if (index == imin) { if (index == imin) {
C2d = BRep_Tool::CurveOnSurface(TopoDS::Edge(It.Key()),F,f,l); TopoDS_Edge aNextEdge = TopoDS::Edge(It.Key());
dpar = (l - f)*0.01; C2d = BRep_Tool::CurveOnSurface(aNextEdge,F,f,l);
vtx = TopExp::LastVertex(aNextEdge, Standard_True);
Standard_Real tolV2 = BRep_Tool::Tolerance(vtx);
Standard_Real aTol2d = Max (surf.UResolution (tolV2), surf.VResolution (tolV2));
dpar = Min(aTol2d,(l - f)*0.01);
if (It.Key().Orientation() == TopAbs_FORWARD) { if (It.Key().Orientation() == TopAbs_FORWARD) {
// plst = C2d->Value(l);
C2d->D1(l,plst,dlst); plst = C2d->Value(l);
if (dlst.Magnitude() < gp::Resolution()) //C2d->D1(l,plst,dlst);
{ //if (dlst.Magnitude() < gp::Resolution())
//{
gp_Pnt2d PrevPnt = C2d->Value(l - dpar); gp_Pnt2d PrevPnt = C2d->Value(l - dpar);
dlst.SetXY(plst.XY() - PrevPnt.XY()); dlst.SetXY(plst.XY() - PrevPnt.XY());
} //}
} }
else { else {
// plst = C2d->Value(f); plst = C2d->Value(f);
C2d->D1(f,plst,dlst); C2d->D1(f,plst,dlst);
if (dlst.Magnitude() < gp::Resolution()) //if (dlst.Magnitude() < gp::Resolution())
{ //{
gp_Pnt2d NextPnt = C2d->Value(f + dpar); gp_Pnt2d NextPnt = C2d->Value(f + dpar);
dlst.SetXY(NextPnt.XY() - plst.XY()); dlst.SetXY(NextPnt.XY() - plst.XY());
} //}
dlst.Reverse(); dlst.Reverse();
} }
break; break;
} }
index++; index++;
} }
//return (imin); return (imin);
} }
//======================================================================= //=======================================================================

View File

@ -1095,7 +1095,7 @@ void FindInternalIntersections(const TopoDS_Edge& theEdge,
Standard_Real /*theFpar, theLpar,*/ aFpar, aLpar; Standard_Real /*theFpar, theLpar,*/ aFpar, aLpar;
const Handle(Geom_Curve)& theCurve = BRep_Tool::Curve(theEdge, thePar[0], thePar[1]); const Handle(Geom_Curve)& theCurve = BRep_Tool::Curve(theEdge, thePar[0], thePar[1]);
GeomAdaptor_Curve theGAcurve(theCurve, thePar[0], thePar[1]); GeomAdaptor_Curve theGAcurve(theCurve, thePar[0], thePar[1]);
Standard_Real aDistMax = Precision::Confusion();
TopExp_Explorer Explo(theFace, TopAbs_EDGE); TopExp_Explorer Explo(theFace, TopAbs_EDGE);
for (; Explo.More(); Explo.Next()) for (; Explo.More(); Explo.Next())
{ {
@ -1117,6 +1117,7 @@ void FindInternalIntersections(const TopoDS_Edge& theEdge,
aNbExt = anExtrema.NbExt(); aNbExt = anExtrema.NbExt();
Standard_Real MaxTol = Max(BRep_Tool::Tolerance(theEdge), BRep_Tool::Tolerance(anEdge)); Standard_Real MaxTol = Max(BRep_Tool::Tolerance(theEdge), BRep_Tool::Tolerance(anEdge));
for (i = 1; i <= aNbExt; i++) for (i = 1; i <= aNbExt; i++)
{ {
Standard_Real aDist = Sqrt(anExtrema.SquareDistance(i)); Standard_Real aDist = Sqrt(anExtrema.SquareDistance(i));
@ -1163,7 +1164,11 @@ void FindInternalIntersections(const TopoDS_Edge& theEdge,
gp_Pnt aPoint = aCurve->Value(anIntPar); gp_Pnt aPoint = aCurve->Value(anIntPar);
if (aPoint.Distance(thePnt[0]) > BRep_Tool::Tolerance(theVertices[0]) && if (aPoint.Distance(thePnt[0]) > BRep_Tool::Tolerance(theVertices[0]) &&
aPoint.Distance(thePnt[1]) > BRep_Tool::Tolerance(theVertices[1])) aPoint.Distance(thePnt[1]) > BRep_Tool::Tolerance(theVertices[1]))
{
SplitPars.Append(theIntPar); SplitPars.Append(theIntPar);
if( aDist > aDistMax)
aDistMax = aDist;
}
} }
} }
} }
@ -1208,6 +1213,8 @@ void FindInternalIntersections(const TopoDS_Edge& theEdge,
LastPar = SplitPars(i); LastPar = SplitPars(i);
gp_Pnt LastPoint = theCurve->Value(LastPar); gp_Pnt LastPoint = theCurve->Value(LastPar);
LastVertex = BRepLib_MakeVertex(LastPoint); LastVertex = BRepLib_MakeVertex(LastPoint);
BRep_Builder aB;
aB.UpdateVertex(LastVertex, aDistMax);
} }
else else
{ {

View File

@ -159,6 +159,7 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
ConnectWiresToWires (iwires, toler, shared, wires); ConnectWiresToWires (iwires, toler, shared, wires);
for (i = 1; i <= edges->Length(); i++) for (i = 1; i <= edges->Length(); i++)
if (iwires->Value(i).Orientation() == TopAbs_REVERSED) if (iwires->Value(i).Orientation() == TopAbs_REVERSED)
edges->ChangeValue(i).Reverse(); edges->ChangeValue(i).Reverse();
@ -248,7 +249,8 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
TopoDS_Vertex Vf, Vl; TopoDS_Vertex Vf, Vl;
Vf = sae.FirstVertex(sewd->Edge(1)); Vf = sae.FirstVertex(sewd->Edge(1));
Vl = sae.LastVertex(sewd->Edge(sewd->NbEdges())); Vl = sae.LastVertex(sewd->Edge(sewd->NbEdges()));
if( Vf.IsNull() || Vl.IsNull())
return;
gp_Pnt pf, pl; gp_Pnt pf, pl;
pf = BRep_Tool::Pnt(Vf); pf = BRep_Tool::Pnt(Vf);
pl = BRep_Tool::Pnt(Vl); pl = BRep_Tool::Pnt(Vl);