Avoid Bnd_Box is void exception when shapes don't intersect.

This commit is contained in:
WandererFan 2016-09-08 14:27:04 -04:00
parent a5b5104875
commit d3afb32487

View File

@ -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>
@ -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());