1 // File: GeomAlgoAPI_Boolean.cpp
2 // Created: 02 Sept 2014
3 // Author: Vitaly Smetannikov
5 #include "GeomAlgoAPI_Boolean.h"
7 #include <BRepAlgoAPI_Cut.hxx>
8 #include <BRepAlgoAPI_Common.hxx>
9 #include <BRepAlgoAPI_Fuse.hxx>
12 boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Boolean::makeCut(
13 boost::shared_ptr<GeomAPI_Shape> theShape,
14 boost::shared_ptr<GeomAPI_Shape> theTool)
16 const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
17 const TopoDS_Shape& aTool = theTool->impl<TopoDS_Shape>();
19 BRepAlgoAPI_Cut aCut(aShape, aTool);
21 boost::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape());
22 aResult->setImpl(new TopoDS_Shape(aCut.Shape()));
25 return boost::shared_ptr<GeomAPI_Shape>();
29 boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Boolean::makeFuse(
30 boost::shared_ptr<GeomAPI_Shape> theShape,
31 boost::shared_ptr<GeomAPI_Shape> theTool)
33 const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
34 const TopoDS_Shape& aTool = theTool->impl<TopoDS_Shape>();
36 BRepAlgoAPI_Fuse aFuse(aShape, aTool);
38 boost::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape());
39 aResult->setImpl(new TopoDS_Shape(aFuse.Shape()));
42 return boost::shared_ptr<GeomAPI_Shape>();
46 boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Boolean::makeCommon(
47 boost::shared_ptr<GeomAPI_Shape> theShape,
48 boost::shared_ptr<GeomAPI_Shape> theTool)
50 const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
51 const TopoDS_Shape& aTool = theTool->impl<TopoDS_Shape>();
53 BRepAlgoAPI_Common aCommon(aShape, aTool);
54 if (aCommon.IsDone()) {
55 boost::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape());
56 aResult->setImpl(new TopoDS_Shape(aCommon.Shape()));
59 return boost::shared_ptr<GeomAPI_Shape>();