]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Removed unused fields from pipe algo
authordbv <dbv@opencascade.com>
Thu, 7 Apr 2016 15:38:24 +0000 (18:38 +0300)
committerdbv <dbv@opencascade.com>
Thu, 7 Apr 2016 16:37:20 +0000 (19:37 +0300)
src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp

index 0143ddc940fa3fdf5cd3d4b0f803781b3c878ffd..38b2eb57e1d5a49bb9ed9073d2e7c57951cd85e2 100644 (file)
@@ -9,6 +9,7 @@
 #include <GeomAPI_Face.h>
 #include <GeomAPI_ShapeExplorer.h>
 #include <GeomAlgoAPI_DFLoader.h>
+#include <GeomAlgoAPI_FaceBuilder.h>
 #include <GeomAlgoAPI_MakeShapeList.h>
 #include <GeomAlgoAPI_ShapeTools.h>
 
@@ -412,7 +413,26 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr&                 theBaseSh
     }
 
     // Try to cut with base face. If it can not be done then keep result of cut with bounding plane.
-    TopoDS_Shape aModifiedBaseShape = aBaseShape;
+    TopoDS_Shape aModifiedBaseShape;
+    if(aShapeTypeToExp != TopAbs_FACE) {
+      ListOfShape aList;
+      GeomShapePtr aSh(new GeomAPI_Shape());
+      aSh->setImpl(new TopoDS_Shape(aBaseShape));
+      std::shared_ptr<GeomAPI_Pnt> theCenter(new GeomAPI_Pnt(aBasePlane->Location().X(),
+                                                             aBasePlane->Location().Y(),
+                                                             aBasePlane->Location().Z()));
+      std::shared_ptr<GeomAPI_Dir> theNormal(new GeomAPI_Dir(aBasePlane->Axis().Direction().X(),
+                                                             aBasePlane->Axis().Direction().Y(),
+                                                             aBasePlane->Axis().Direction().Z()));
+      GeomShapePtr aPln = GeomAlgoAPI_FaceBuilder::planarFace(theCenter, theNormal);
+
+      aList.push_back(aSh);
+      std::list<std::shared_ptr<GeomAPI_Pnt> > aBoundingPoints = GeomAlgoAPI_ShapeTools::getBoundingBox(aList);
+
+      aSh = GeomAlgoAPI_ShapeTools::fitPlaneToBox(aPln, aBoundingPoints);
+    } else {
+      aModifiedBaseShape = aBaseShape;
+    }
     if(isFromFaceSet) {
       if(aModifiedBaseShape.ShapeType() == TopAbs_FACE) {
         aModifiedBaseShape.Orientation(TopAbs_REVERSED);