DiscussionsIssue archiveOther usage issues

Archived discussion

How to secure fillet building

Other usage issuesTue, 08/16/2005 - 10:401 reply

Browse this forum
QuestionAuthor

Hi,

I have the following code :

BRepOffsetAPI_Sewing sew;
// loop for creating faces/surfaces
for( ..... ) {
// faces/surfaces creation
...
// adding faces/surfaces to sew
sew.Add(face);
}
sew.Perform();

// create a shape from sew
TopoDS_Shape body = sew.SewedShape();

// applying fillets on edges
BRepFilletAPI_MakeFillet mkFillet(body);
TopExp_Explorer aEdgeExplorer(body , TopAbs_EDGE);
while( aEdgeExplorer.More() ) {
TopoDS_Edge aEdge = TopoDS::Edge(aEdgeExplorer.Current());
mkFillet.Add(15.0, aEdge);
aEdgeExplorer.Next();
}
body = mkFillet.Shape();

How can I secure this code? If a fillet cannot be build on Edge (ie fillet is too big for connected faces), I don't want my app crashes.

Thank you for answer.
Best regards.
thm.

Discussion

1 archived reply

Posts are displayed in their archived order.

01Commenter-1

Although OCC does occasionally crash, it is rare. It is usually pretty good about throwing exceptions or setting status flags where appropriate. First, you should definitely check IsDone() on your mkFillet object before retrieving the shape (this is defined in the base class BRepBuilderAPI_Command). Second, you should probably surround all your OCC code in a try...catch block.

try {
...
}
catch (Standard_Failure) {
Handle(Standard_Failure) E = Standard_Failure::Caught();
cout << E->DynamicType()->Name() << ":" << E->GetMessageString() << endl;
}