mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-05-23 05:49:13 +08:00
0033180: We had a problem calling the OCC library at the customer site, and the program crashed
Added status for thrusection operations and changed throw constructions to set of the status and break the function.
This commit is contained in:
@@ -262,6 +262,7 @@ BRepOffsetAPI_ThruSections::BRepOffsetAPI_ThruSections(const Standard_Boolean is
|
||||
myCritWeights[1] = .2;
|
||||
myCritWeights[2] = .4;
|
||||
myUseSmoothing = Standard_False;
|
||||
myStatus = BRepFill_ThruSectionErrorStatus_NotDone;
|
||||
}
|
||||
|
||||
|
||||
@@ -286,7 +287,7 @@ void BRepOffsetAPI_ThruSections::Init(const Standard_Boolean isSolid, const Stan
|
||||
myCritWeights[1] = .2;
|
||||
myCritWeights[2] = .4;
|
||||
myUseSmoothing = Standard_False;
|
||||
|
||||
myStatus = BRepFill_ThruSectionErrorStatus_NotDone;
|
||||
}
|
||||
|
||||
|
||||
@@ -343,6 +344,7 @@ void BRepOffsetAPI_ThruSections::CheckCompatibility(const Standard_Boolean check
|
||||
|
||||
void BRepOffsetAPI_ThruSections::Build(const Message_ProgressRange& /*theRange*/)
|
||||
{
|
||||
myStatus = BRepFill_ThruSectionErrorStatus_Done;
|
||||
myBFGenerator.Nullify();
|
||||
//Check set of section for right configuration of punctual sections
|
||||
Standard_Integer i;
|
||||
@@ -356,7 +358,10 @@ void BRepOffsetAPI_ThruSections::Build(const Message_ProgressRange& /*theRange*/
|
||||
wdeg = wdeg && (BRep_Tool::Degenerated(anEdge));
|
||||
}
|
||||
if (wdeg)
|
||||
throw Standard_Failure("Wrong usage of punctual sections");
|
||||
{
|
||||
myStatus = BRepFill_ThruSectionErrorStatus_WrongUsage;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (myWires.Length() <= 2)
|
||||
{
|
||||
@@ -371,7 +376,8 @@ void BRepOffsetAPI_ThruSections::Build(const Message_ProgressRange& /*theRange*/
|
||||
}
|
||||
if (wdeg)
|
||||
{
|
||||
throw Standard_Failure("Wrong usage of punctual sections");
|
||||
myStatus = BRepFill_ThruSectionErrorStatus_WrongUsage;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,6 +453,13 @@ void BRepOffsetAPI_ThruSections::Build(const Message_ProgressRange& /*theRange*/
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
myStatus = Georges.GetStatus();
|
||||
NotDone();
|
||||
return;
|
||||
}
|
||||
|
||||
myWires = WorkingSections;
|
||||
} //if (myWCheck)
|
||||
else //no check
|
||||
@@ -498,6 +511,12 @@ void BRepOffsetAPI_ThruSections::Build(const Message_ProgressRange& /*theRange*/
|
||||
NotDone();
|
||||
return;
|
||||
}
|
||||
|
||||
if (myStatus != BRepFill_ThruSectionErrorStatus_Done)
|
||||
{
|
||||
NotDone();
|
||||
return;
|
||||
}
|
||||
// Encode the Regularities
|
||||
BRepLib::EncodeRegularity(myShape);
|
||||
}
|
||||
@@ -520,6 +539,12 @@ void BRepOffsetAPI_ThruSections::CreateRuled()
|
||||
myBFGenerator->AddWire(TopoDS::Wire(myWires(i)));
|
||||
}
|
||||
myBFGenerator->Perform();
|
||||
BRepFill_ThruSectionErrorStatus aStatus = myBFGenerator->GetStatus();
|
||||
if (aStatus != BRepFill_ThruSectionErrorStatus_Done)
|
||||
{
|
||||
myStatus = aStatus;
|
||||
return;
|
||||
}
|
||||
TopoDS_Shell shell = myBFGenerator->Shell();
|
||||
|
||||
if (myIsSolid) {
|
||||
@@ -739,6 +764,7 @@ void BRepOffsetAPI_ThruSections::CreateSmoothed()
|
||||
TS = TotalSurf(shapes,nbSects,nbEdges,w1Point,w2Point,vClosed);
|
||||
|
||||
if(TS.IsNull()) {
|
||||
myStatus = BRepFill_ThruSectionErrorStatus_Failed;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -934,14 +960,12 @@ void BRepOffsetAPI_ThruSections::CreateSmoothed()
|
||||
else {
|
||||
myShape = MakeSolid(shell, newW1, newW2, myPres3d, myFirst, myLast);
|
||||
}
|
||||
|
||||
Done();
|
||||
}
|
||||
|
||||
else {
|
||||
myShape = shell;
|
||||
Done();
|
||||
}
|
||||
Done();
|
||||
|
||||
TopTools_DataMapOfShapeReal aVertexToleranceMap;
|
||||
TopExp_Explorer aTopExplorer(myShape,TopAbs_EDGE);
|
||||
@@ -1040,7 +1064,9 @@ static Handle(Geom_BSplineCurve) EdgeToBSpline (const TopoDS_Edge& theEdge)
|
||||
Standard_Real aFirst, aLast;
|
||||
Handle(Geom_Curve) aCurve = BRep_Tool::Curve (theEdge, aLoc, aFirst, aLast);
|
||||
if (aCurve.IsNull())
|
||||
throw Standard_NullObject("Null 3D curve in edge");
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// convert its part used by edge to bspline; note that if edge curve is bspline,
|
||||
// conversion made via trimmed curve is still needed -- it will copy it, segment
|
||||
@@ -1132,6 +1158,10 @@ Handle(Geom_BSplineSurface) BRepOffsetAPI_ThruSections::
|
||||
// read the first edge to initialise CompBS;
|
||||
TopoDS_Edge aPrevEdge = TopoDS::Edge (shapes((j-1)*NbEdges+1));
|
||||
Handle(Geom_BSplineCurve) curvBS = EdgeToBSpline (aPrevEdge);
|
||||
if (curvBS.IsNull())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// initialization
|
||||
GeomConvert_CompCurveToBSplineCurve CompBS(curvBS);
|
||||
@@ -1145,6 +1175,10 @@ Handle(Geom_BSplineSurface) BRepOffsetAPI_ThruSections::
|
||||
aTolV = Max(aTolV, BRep_Tool::Tolerance(vl));
|
||||
aTolV = Min(aTolV, 1.e-3);
|
||||
curvBS = EdgeToBSpline (aNextEdge);
|
||||
if (curvBS.IsNull())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// concatenation
|
||||
CompBS.Add(curvBS, aTolV, Standard_True, Standard_False, 1);
|
||||
@@ -1503,7 +1537,11 @@ void BRepOffsetAPI_ThruSections::CriteriumWeight(Standard_Real& W1, Standard_Rea
|
||||
|
||||
void BRepOffsetAPI_ThruSections::SetCriteriumWeight(const Standard_Real W1, const Standard_Real W2, const Standard_Real W3)
|
||||
{
|
||||
if (W1 < 0 || W2 < 0 || W3 < 0 ) throw Standard_DomainError();
|
||||
if (W1 < 0 || W2 < 0 || W3 < 0)
|
||||
{
|
||||
myStatus = BRepFill_ThruSectionErrorStatus_Failed;
|
||||
return;
|
||||
}
|
||||
myCritWeights[0] = W1;
|
||||
myCritWeights[1] = W2;
|
||||
myCritWeights[2] = W3;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <BRepFill_ThruSectionErrorStatus.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
@@ -163,6 +164,11 @@ public:
|
||||
//! Returns the current mutable input state
|
||||
Standard_EXPORT Standard_Boolean IsMutableInput() const;
|
||||
|
||||
//! Returns the status of thrusection operation
|
||||
BRepFill_ThruSectionErrorStatus GetStatus() const
|
||||
{
|
||||
return myStatus;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -206,6 +212,7 @@ private:
|
||||
Standard_Boolean myUseSmoothing;
|
||||
Standard_Boolean myMutableInput;
|
||||
NCollection_Handle<BRepFill_Generator> myBFGenerator;
|
||||
BRepFill_ThruSectionErrorStatus myStatus;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user