X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FBuildAPI%2FBuildAPI_Solid.cpp;fp=src%2FBuildAPI%2FBuildAPI_Solid.cpp;h=a2c7892a1b1c4e7d4a6cef00e24f147ad35775c9;hb=dfa8d5cc9a33eb949f364e1999dc36e75fd1ffe8;hp=0000000000000000000000000000000000000000;hpb=24d2e3827b4cbc628620b97981d9c54afb802e5c;p=modules%2Fshaper.git diff --git a/src/BuildAPI/BuildAPI_Solid.cpp b/src/BuildAPI/BuildAPI_Solid.cpp new file mode 100644 index 000000000..a2c7892a1 --- /dev/null +++ b/src/BuildAPI/BuildAPI_Solid.cpp @@ -0,0 +1,71 @@ +// Copyright (C) 2017-20xx 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 "BuildAPI_Solid.h" + +#include +#include + +//================================================================================================== +BuildAPI_Solid::BuildAPI_Solid(const std::shared_ptr& theFeature) +: ModelHighAPI_Interface(theFeature) +{ + initialize(); +} + +//================================================================================================== +BuildAPI_Solid::BuildAPI_Solid(const std::shared_ptr& theFeature, + const std::list& theBaseObjects) +: ModelHighAPI_Interface(theFeature) +{ + if(initialize()) { + setBase(theBaseObjects); + } +} + +//================================================================================================== +BuildAPI_Solid::~BuildAPI_Solid() +{ +} + +//================================================================================================== +void BuildAPI_Solid::setBase(const std::list& theBaseObjects) +{ + fillAttribute(theBaseObjects, mybaseObjects); + execute(); +} + +//================================================================================================== +void BuildAPI_Solid::dump(ModelHighAPI_Dumper& theDumper) const +{ + FeaturePtr aBase = feature(); + std::string aPartName = theDumper.name(aBase->document()); + + theDumper << aBase << " = model.addSolid(" << aPartName << ", " + << aBase->selectionList(BuildPlugin_Solid::BASE_OBJECTS_ID()) << ")" << std::endl; +} + +//================================================================================================== +SolidPtr addSolid(const std::shared_ptr& thePart, + const std::list& theBaseObjects) +{ + std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Solid::ID()); + return SolidPtr(new BuildAPI_Solid(aFeature, theBaseObjects)); +}