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,
22 std::string& theError,
28 std::cout << "Import XAO from file " << theFileName << std::endl;
32 if (XAO::XaoExporter::readFromFile(theFileName, theXao)) {
33 XAO::Geometry* aGeometry = theXao->getGeometry();
34 XAO::Format aFormat = aGeometry->getFormat();
35 if (aFormat == XAO::BREP) {
36 if (XAO::BrepGeometry* aBrepGeometry = dynamic_cast<XAO::BrepGeometry*>(aGeometry))
37 aShape = aBrepGeometry->getTopoDS_Shape();
39 theError = "Unsupported XAO geometry format:" + XAO::XaoUtils::shapeFormatToString(aFormat);
43 theError = "XAO object was not read successful";
46 } catch (XAO::XAO_Exception& e) {
51 std::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape);
52 aGeomShape->setImpl(new TopoDS_Shape(aShape));