Salome HOME
Boolean operations created
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Boolean.cpp
index 0f68186e4b67cc01235f573e72d640783e09693b..d56a226aa8795aa529a5f865c79b6706cb2be649 100644 (file)
@@ -5,6 +5,8 @@
 #include "GeomAlgoAPI_Boolean.h"
 
 #include <BRepAlgoAPI_Cut.hxx>
+#include <BRepAlgoAPI_Common.hxx>
+#include <BRepAlgoAPI_Fuse.hxx>
 
 
 boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Boolean::makeCut(
@@ -22,3 +24,37 @@ boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Boolean::makeCut(
   }
   return boost::shared_ptr<GeomAPI_Shape>();
 }
+
+
+boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Boolean::makeFuse(
+  boost::shared_ptr<GeomAPI_Shape> theShape,
+  boost::shared_ptr<GeomAPI_Shape> theTool)
+{
+  const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
+  const TopoDS_Shape& aTool = theTool->impl<TopoDS_Shape>();
+
+  BRepAlgoAPI_Fuse aFuse(aShape, aTool);
+  if (aFuse.IsDone()) {
+    boost::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape());
+    aResult->setImpl(new TopoDS_Shape(aFuse.Shape()));
+    return aResult;
+  }
+  return boost::shared_ptr<GeomAPI_Shape>();
+}
+
+
+boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Boolean::makeCommon(
+  boost::shared_ptr<GeomAPI_Shape> theShape,
+  boost::shared_ptr<GeomAPI_Shape> theTool)
+{
+  const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
+  const TopoDS_Shape& aTool = theTool->impl<TopoDS_Shape>();
+
+  BRepAlgoAPI_Common aCommon(aShape, aTool);
+  if (aCommon.IsDone()) {
+    boost::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape());
+    aResult->setImpl(new TopoDS_Shape(aCommon.Shape()));
+    return aResult;
+  }
+  return boost::shared_ptr<GeomAPI_Shape>();
+}
\ No newline at end of file