1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #include <GeomAlgoAPI_XAOExport.h>
23 #include "GeomAlgoAPI_Tools.h"
25 #include <TopoDS_Shape.hxx>
27 #include <XAO_XaoExporter.hxx>
28 #include <XAO_BrepGeometry.hxx>
30 //=============================================================================
31 bool SetShapeToXAO(const std::shared_ptr<GeomAPI_Shape>& theShape,
33 std::string& theError)
35 if (!theShape.get() || !theXao) {
36 theError = "An invalid argument.";
40 TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
42 XAO::BrepGeometry* aGeometry = new XAO::BrepGeometry;
43 theXao->setGeometry(aGeometry);
44 aGeometry->setTopoDS_Shape(aShape);
45 } catch (XAO::XAO_Exception& e) {
52 //=============================================================================
56 //=============================================================================
57 bool XAOExport(const std::string& theFileName,
59 std::string& theError)
62 std::cout << "Export XAO into file " << theFileName << std::endl;
65 if (theFileName.empty() || !theXao) {
66 theError = "An invalid argument.";
71 XAO::XaoExporter::saveToFile(theXao, theFileName, "");
72 } catch (XAO::XAO_Exception& e) {