Salome HOME
Test case bugs/N4. A fix by PKV.
[modules/geom.git] / src / GEOMImpl / GEOMImpl_PrismDriver.cxx
index 535d030a2b6fec959014587d45667518b07229cc..87b18275d80f0f610ff203fd5ef1200aa91ebd18 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -450,10 +450,11 @@ TopoDS_Shape GEOMImpl_PrismDriver::MakeDraftPrism ( const TopoDS_Shape& theInitS
     if (!aWire.Closed())
       Standard_ConstructionError::Raise("The input profile is not closed");
     
-    // Construction of the face if the wire hasn't any support face
-    TopoDS_Face aFaceBase = BRepBuilderAPI_MakeFace(aWire);
+    // Construction of the face if the wire hasn't any support face;
+    // the face must be planar for BRepFeat_MakeDPrism
+    TopoDS_Face aFaceBase = BRepBuilderAPI_MakeFace(aWire, /*OnlyPlane=*/true);
 
-    if(!theSupport.IsNull() && theSupport.ShapeType() == TopAbs_FACE)      // If the wire has a support
+    if(!theSupport.IsNull() && theSupport.ShapeType() == TopAbs_FACE) // If the wire has a support
     {
       Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(theSupport));
       TopoDS_Face aTempFace = BRepBuilderAPI_MakeFace(aSurf, aWire);
@@ -481,10 +482,11 @@ TopoDS_Shape GEOMImpl_PrismDriver::MakeDraftPrism ( const TopoDS_Shape& theInitS
       aHeight  = -theHeight;
     }
     
-    BRepFeat_MakeDPrism aPrism(theInitShape, aFaceBase, TopoDS_Face(),
-                              anAngle*PI180, isProtrusion, Standard_True); 
+    BRepFeat_MakeDPrism aPrism(theInitShape, aFaceBase, aFaceBase,
+                               anAngle*M_PI/180., isProtrusion, Standard_True); 
     
     aPrism.Perform(aHeight);
+    aPrism.Check();          // Raises NotDone if done is false
     
     aShape = aPrism.Shape();