0022862: EDF GEOM: MakeFillet returns a compound

This commit is contained in:
vsr 2015-02-11 19:15:22 +03:00
parent ed7afb89f4
commit e450289112
3 changed files with 32 additions and 1 deletions

View 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;

View 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;
}

View 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