Skip to content

Commit

Permalink
+ raise exceptions in TopoShape::makeOffsetShape if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed May 15, 2015
1 parent 4fe99f2 commit 78671cb
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions src/Mod/Part/App/TopoShape.cpp
Expand Up @@ -1964,21 +1964,18 @@ TopoDS_Shape TopoShape::makeOffsetShape(double offset, double tol, bool intersec
selfInter ? Standard_True : Standard_False,
GeomAbs_JoinType(join));
if (!mkOffset.IsDone())
return TopoDS_Shape(); //maybe throw exception?
Standard_Failure::Raise("BRepOffsetAPI_MakeOffsetShape not done");
const TopoDS_Shape& res = mkOffset.Shape();
if (!fill)
return res;

//get perimeter wire of original shape.
//Wires returned seem to have edges in connection order.
ShapeAnalysis_FreeBoundsProperties freeCheck(this->_Shape);
freeCheck.Perform();
if (freeCheck.NbClosedFreeBounds() < 1)
{
std::ostringstream stream;
stream << "no closed bounds" << std::endl;
Base::Console().Message(stream.str().c_str());
return TopoDS_Shape(); //maybe throw exception?
Standard_Failure::Raise("no closed bounds");
}

BRep_Builder builder;
Expand All @@ -1997,10 +1994,7 @@ TopoDS_Shape TopoShape::makeOffsetShape(double offset, double tol, bool intersec
{
if (!img.HasImage(xp.Current()))
{
std::ostringstream stream;
stream << "no image for shape" << std::endl;
Base::Console().Message(stream.str().c_str());
return TopoDS_Shape();
Standard_Failure::Raise("no image for shape");
}
const TopTools_ListOfShape& currentImage = img.Image(xp.Current());
TopTools_ListIteratorOfListOfShape listIt;
Expand All @@ -2018,8 +2012,7 @@ TopoDS_Shape TopoShape::makeOffsetShape(double offset, double tol, bool intersec
{
std::ostringstream stream;
stream << "wrong edge count: " << edgeCount << std::endl;
Base::Console().Message(stream.str().c_str());
return TopoDS_Shape();
Standard_Failure::Raise(stream.str().c_str());
}
builder.Add(offsetWire, mappedEdge);
}
Expand All @@ -2033,10 +2026,7 @@ TopoDS_Shape TopoShape::makeOffsetShape(double offset, double tol, bool intersec
aGenerator.Build();
if (!aGenerator.IsDone())
{
std::ostringstream stream;
stream << "ThruSections failed" << std::endl;
Base::Console().Message(stream.str().c_str());
return TopoDS_Shape();
Standard_Failure::Raise("ThruSections failed");
}

builder.Add(perimeterCompound, aGenerator.Shape());
Expand Down

0 comments on commit 78671cb

Please sign in to comment.