1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0022823: Exception in thickshell operation

This commit is contained in:
JGV 2011-12-23 06:42:09 +00:00 committed by bugmaster
parent a6535b1d3f
commit de878dad9a

View File

@ -2827,65 +2827,67 @@ void BRepOffset_MakeOffset::MakeMissingWalls ()
Standard_Boolean IsPlanar = Standard_False; Standard_Boolean IsPlanar = Standard_False;
if (BAcurve.GetType() == GeomAbs_Circle && if (BAcurve.GetType() == GeomAbs_Circle &&
BAcurveOE.GetType() == GeomAbs_Circle) BAcurveOE.GetType() == GeomAbs_Circle)
{ {
gp_Circ aCirc = BAcurve.Circle(); gp_Circ aCirc = BAcurve.Circle();
gp_Dir CircAxisDir = aCirc.Axis().Direction(); gp_Circ aCircOE = BAcurveOE.Circle();
if (OffsetDir.IsParallel( CircAxisDir, Precision::Confusion() )) //case of cylinder gp_Lin anAxisLine(aCirc.Axis());
theSurf = GC_MakeCylindricalSurface(aCirc).Value(); gp_Dir CircAxisDir = aCirc.Axis().Direction();
else if (Abs(OffsetDir * CircAxisDir) > Precision::PConfusion()) //case of cone if (aCirc.Axis().IsParallel(aCircOE.Axis(), Precision::Confusion()) &&
{ anAxisLine.Contains(aCircOE.Location(), Precision::Confusion()))
gp_Circ aCircOE = BAcurveOE.Circle(); { //cylinder or cone
gp_Cone theCone = gce_MakeCone(aCirc.Location(), aCircOE.Location(), if (Abs(aCirc.Radius() - aCircOE.Radius()) <= Precision::Confusion()) //case of cylinder
aCirc.Radius(), aCircOE.Radius()); theSurf = GC_MakeCylindricalSurface(aCirc).Value();
gp_Ax3 theAx3(aCirc.Position()); else //case of cone
if (CircAxisDir * theCone.Axis().Direction() < 0.) {
{ gp_Cone theCone = gce_MakeCone(aCirc.Location(), aCircOE.Location(),
theAx3.ZReverse(); aCirc.Radius(), aCircOE.Radius());
CircAxisDir.Reverse(); gp_Ax3 theAx3(aCirc.Position());
} if (CircAxisDir * theCone.Axis().Direction() < 0.)
theCone.SetPosition(theAx3); {
theSurf = new Geom_ConicalSurface(theCone); theAx3.ZReverse();
} CircAxisDir.Reverse();
if (!theSurf.IsNull()) }
{ theCone.SetPosition(theAx3);
TopLoc_Location Loc; theSurf = new Geom_ConicalSurface(theCone);
EdgeLine2d = new Geom2d_Line(gp_Pnt2d(0., 0.), gp_Dir2d(1., 0.)); }
BB.UpdateEdge(anEdge, EdgeLine2d, theSurf, Loc, Precision::Confusion()); TopLoc_Location Loc;
Standard_Real Coeff = (OffsetDir * CircAxisDir > 0.)? 1. : -1.; EdgeLine2d = new Geom2d_Line(gp_Pnt2d(0., 0.), gp_Dir2d(1., 0.));
OELine2d = new Geom2d_Line(gp_Pnt2d(0., OffsetVal*Coeff), gp_Dir2d(1., 0.)); BB.UpdateEdge(anEdge, EdgeLine2d, theSurf, Loc, Precision::Confusion());
BB.UpdateEdge(OE, OELine2d, theSurf, Loc, Precision::Confusion()); Standard_Real Coeff = (OffsetDir * CircAxisDir > 0.)? 1. : -1.;
aLine2d = new Geom2d_Line(gp_Pnt2d(ParV2, 0.), gp_Dir2d(0., Coeff)); OELine2d = new Geom2d_Line(gp_Pnt2d(0., OffsetVal*Coeff), gp_Dir2d(1., 0.));
aLine2d2 = new Geom2d_Line(gp_Pnt2d(ParV1, 0.), gp_Dir2d(0., Coeff)); BB.UpdateEdge(OE, OELine2d, theSurf, Loc, Precision::Confusion());
if (E3.IsSame(E4)) aLine2d = new Geom2d_Line(gp_Pnt2d(ParV2, 0.), gp_Dir2d(0., Coeff));
{ aLine2d2 = new Geom2d_Line(gp_Pnt2d(ParV1, 0.), gp_Dir2d(0., Coeff));
if (Coeff > 0.) if (E3.IsSame(E4))
BB.UpdateEdge(E3, aLine2d, aLine2d2, theSurf, Loc, Precision::Confusion()); {
else if (Coeff > 0.)
{ BB.UpdateEdge(E3, aLine2d, aLine2d2, theSurf, Loc, Precision::Confusion());
BB.UpdateEdge(E3, aLine2d2, aLine2d, theSurf, Loc, Precision::Confusion()); else
theWire.Nullify(); {
BB.MakeWire(theWire); BB.UpdateEdge(E3, aLine2d2, aLine2d, theSurf, Loc, Precision::Confusion());
BB.Add(theWire, anEdge.Oriented(TopAbs_REVERSED)); theWire.Nullify();
BB.Add(theWire, E4); BB.MakeWire(theWire);
BB.Add(theWire, OE.Oriented(TopAbs_FORWARD)); BB.Add(theWire, anEdge.Oriented(TopAbs_REVERSED));
BB.Add(theWire, E3); BB.Add(theWire, E4);
theWire.Closed(Standard_True); BB.Add(theWire, OE.Oriented(TopAbs_FORWARD));
} BB.Add(theWire, E3);
} theWire.Closed(Standard_True);
else }
{ }
BB.SameParameter(E3, Standard_False); else
BB.SameRange(E3, Standard_False); {
BB.SameParameter(E4, Standard_False); BB.SameParameter(E3, Standard_False);
BB.SameRange(E4, Standard_False); BB.SameRange(E3, Standard_False);
BB.UpdateEdge(E3, aLine2d, theSurf, Loc, Precision::Confusion()); BB.SameParameter(E4, Standard_False);
BB.Range(E3, theSurf, Loc, 0., OffsetVal); BB.SameRange(E4, Standard_False);
BB.UpdateEdge(E4, aLine2d2, theSurf, Loc, Precision::Confusion()); BB.UpdateEdge(E3, aLine2d, theSurf, Loc, Precision::Confusion());
BB.Range(E4, theSurf, Loc, 0., OffsetVal); BB.Range(E3, theSurf, Loc, 0., OffsetVal);
} BB.UpdateEdge(E4, aLine2d2, theSurf, Loc, Precision::Confusion());
NewFace = BRepLib_MakeFace(theSurf, theWire); BB.Range(E4, theSurf, Loc, 0., OffsetVal);
} }
} NewFace = BRepLib_MakeFace(theSurf, theWire);
} //cylinder or cone
} //if both edges are arcs of circles
if (NewFace.IsNull()) if (NewFace.IsNull())
{ {
BRepLib_MakeFace MF(theWire, Standard_True); //Only plane BRepLib_MakeFace MF(theWire, Standard_True); //Only plane