X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_Sewing.cpp;h=b30d1dd60dff6c9a82730b1f1f6534ecffac00d3;hb=53445a818411b3b71e3457f5e2e97c5f23d69cb7;hp=4539b086399653dab79acee6262cf0ab7c27aea3;hpb=4aa37ed1eb429f7391098b5202922d43e85fcc30;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp index 4539b0863..b30d1dd60 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp @@ -1,9 +1,22 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: GeomAlgoAPI_Sewing.cpp -// Created: 25 April 2016 -// Author: Dmitry Bobylev - +// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or +// email : webmaster.salome@opencascade.com +// #include "GeomAlgoAPI_Sewing.h" @@ -38,22 +51,26 @@ void GeomAlgoAPI_Sewing::build(const ListOfShape& theShapes) TopoDS_Shape aResult = aSewingBuilder->SewedShape(); BRep_Builder aBuilder; - TopoDS_Compound aResultCompound; - aBuilder.MakeCompound(aResultCompound); - for(TopoDS_Iterator anIt(aResult); anIt.More(); anIt.Next()) { - const TopoDS_Shape aSubShape = anIt.Value(); - if(aSubShape.ShapeType() == TopAbs_SHELL) { - aBuilder.Add(aResultCompound, aSubShape); - } else if (aSubShape.ShapeType() == TopAbs_FACE) { - TopoDS_Shell aShell; - aBuilder.MakeShell(aShell); - aBuilder.Add(aShell, aSubShape); - aBuilder.Add(aResultCompound, aShell); + if(aResult.ShapeType() == TopAbs_COMPOUND) { + TopoDS_Compound aResultCompound; + aBuilder.MakeCompound(aResultCompound); + for(TopoDS_Iterator anIt(aResult); anIt.More(); anIt.Next()) { + const TopoDS_Shape aSubShape = anIt.Value(); + if(aSubShape.ShapeType() == TopAbs_SHELL) { + aBuilder.Add(aResultCompound, aSubShape); + } else if (aSubShape.ShapeType() == TopAbs_FACE) { + TopoDS_Shell aShell; + aBuilder.MakeShell(aShell); + aBuilder.Add(aShell, aSubShape); + aBuilder.Add(aResultCompound, aShell); + } } - } - TopoDS_Iterator anIt(aResultCompound); - if(anIt.More()) { aResult = aResultCompound; + } else if(aResult.ShapeType() == TopAbs_FACE) { + TopoDS_Shell aShell; + aBuilder.MakeShell(aShell); + aBuilder.Add(aShell, aResult); + aResult = aShell; } std::shared_ptr aShape(new GeomAPI_Shape());