Skip to content

Commit

Permalink
Avoid Bnd_Box is void exception when shapes don't intersect.
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Sep 11, 2016
1 parent a5b5104 commit d3afb32
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Mod/TechDraw/App/DrawViewSection.cpp
Expand Up @@ -28,6 +28,8 @@
#ifndef _PreComp_
# include <sstream>

#include <Bnd_Box.hxx>
#include <BRepBndLib.hxx>
#include <BRepBuilderAPI_MakePolygon.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepAlgoAPI_Cut.hxx>
Expand Down Expand Up @@ -196,6 +198,12 @@ App::DocumentObjectExecReturn *DrawViewSection::execute(void)
return new App::DocumentObjectExecReturn("Section cut has failed");

TopoDS_Shape rawShape = mkCut.Shape();
Bnd_Box testBox;
BRepBndLib::Add(rawShape, testBox);
testBox.SetGap(0.0);
if (testBox.IsVoid()) { //prism & input don't intersect. rawShape is garbage, don't bother.
return DrawView::execute();
}

geometryObject->setTolerance(Tolerance.getValue());
geometryObject->setScale(Scale.getValue());
Expand Down

0 comments on commit d3afb32

Please sign in to comment.