]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0022862: EDF GEOM: MakeFillet returns a compound
authorvsr <vsr@opencascade.com>
Wed, 11 Feb 2015 16:15:22 +0000 (19:15 +0300)
committervsr <vsr@opencascade.com>
Wed, 11 Feb 2015 16:15:22 +0000 (19:15 +0300)
src/GEOMImpl/GEOMImpl_FilletDriver.cxx
src/GEOMUtils/GEOMUtils.cxx
src/GEOMUtils/GEOMUtils.hxx

index f49fb08f71afebef52e1bd641b922379499a7c8a..034d2f274d8e56ffad30d3d32987ab8a16740f4b 100644 (file)
@@ -130,7 +130,7 @@ Standard_Integer GEOMImpl_FilletDriver::Execute(TFunction_Logbook& log) const
   if (!fill.IsDone()) {
     StdFail_NotDone::Raise("Fillet can't be computed on the given shape with the given radius");
   }
-  aShape = fill.Shape();
+  aShape = GEOMUtils::ReduceCompound( fill.Shape() );
 
   if (aShape.IsNull()) return 0;
 
index 3087c82d394f439750cf1cc89d7f2a15e2b18426..6d9643f0ce90eed0abbdc957fe29c36bc4cdd35b 100644 (file)
@@ -1174,3 +1174,22 @@ bool GEOMUtils::Write( const TopoDS_Shape& shape, const char* fileName )
 {
   return BRepTools::Write( shape, fileName );
 }
+
+TopoDS_Shape GEOMUtils::ReduceCompound( const TopoDS_Shape& shape )
+{
+  TopoDS_Shape result = shape;
+
+  if ( shape.ShapeType() == TopAbs_COMPOUND ||
+       shape.ShapeType() == TopAbs_COMPSOLID ) {
+
+    TopTools_ListOfShape l;
+    
+    TopoDS_Iterator it ( shape );
+    for ( ; it.More(); it.Next() )
+      l.Append( it.Value() );
+    if ( l.Extent() == 1 && l.First() != shape )
+      result = ReduceCompound( l.First() );
+  }
+  
+  return result;
+}
index 2a35dceda7709b15739cf830e138a98821fad4c6..b673ea8078d6edd9e7374919fcce25e14058178f 100644 (file)
@@ -300,6 +300,18 @@ namespace GEOMUtils
    */
   Standard_EXPORT bool Write( const TopoDS_Shape& shape,
                               const char* fileName );
+  
+  /*!
+   * \brief Extract single SOLID from COMPSOLID or COMPOUND.
+   *
+   * If the argument shape is a COMPUND or COMPSOLID and there's
+   * only single simple-shape type inside, this sub-shape is returned as a result;
+   * otherwise, the shape is not changed.
+   *
+   * \param shape compound or compsolid being processed.
+   * \retval TopoDS_Shape resulting shape
+   */
+  Standard_EXPORT TopoDS_Shape ReduceCompound( const TopoDS_Shape& shape );
 };
 
 #endif