]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/GeomAPI/GeomAPI_Shape.cpp
Salome HOME
Make plane as close as possible to selected shape by its size
[modules/shaper.git] / src / GeomAPI / GeomAPI_Shape.cpp
index 36fa298ef1b2e48dad1c9dcef4bca6136fba4ba4..6cb6f74c4b8b0dcbf7a31ce122f9c0177442deac 100644 (file)
@@ -7,6 +7,8 @@
 #include<GeomAPI_Shape.h>
 
 #include <TopoDS_Shape.hxx>
+#include <BRepBndLib.hxx>
+#include <Bnd_Box.hxx>
 
 #define MY_SHAPE static_cast<TopoDS_Shape*>(myImpl)
 
@@ -47,3 +49,15 @@ bool GeomAPI_Shape::isFace() const
   const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
   return aShape.ShapeType() == TopAbs_FACE;
 }
+
+bool GeomAPI_Shape::computeSize(double& theXmin, double& theYmin, double& theZmin,
+                                double& theXmax, double& theYmax, double& theZmax) const
+{
+  const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
+  if (aShape.IsNull())
+    return false;
+  Bnd_Box aBndBox;
+  BRepBndLib::Add(aShape, aBndBox);
+  aBndBox.Get(theXmin, theYmin, theZmin, theXmax, theYmax, theZmax);
+  return true;
+}
\ No newline at end of file