1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GEOMALGOAPI_XAOImport.cpp
4 // Created: Nov 25, 2015
5 // Author: Sergey POKHODENKO
7 #include <GeomAlgoAPI_XAOImport.h>
11 #include <TopoDS_Shape.hxx>
13 #include <XAO_XaoExporter.hxx>
14 #include <XAO_BrepGeometry.hxx>
16 //=============================================================================
20 //=============================================================================
21 std::shared_ptr<GeomAPI_Shape> XAOImport(const std::string& theFileName,
23 std::string& theError,
29 std::cout << "Import XAO from file " << theFileName << std::endl;
34 if (XAO::XaoExporter::readFromFile(theFileName, theXao/*&aXao*/)) {
35 XAO::Geometry* aGeometry = /*aXao*/theXao->getGeometry();
36 XAO::Format aFormat = aGeometry->getFormat();
37 if (aFormat == XAO::BREP) {
38 if (XAO::BrepGeometry* aBrepGeometry = dynamic_cast<XAO::BrepGeometry*>(aGeometry))
39 aShape = aBrepGeometry->getTopoDS_Shape();
41 theError = "Unsupported XAO geometry format:" + XAO::XaoUtils::shapeFormatToString(aFormat);
45 theError = "XAO object was not read successful";
48 } catch (XAO::XAO_Exception& e) {
53 std::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape);
54 aGeomShape->setImpl(new TopoDS_Shape(aShape));