X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FExchangePlugin%2FExchangePlugin_ImportFeature.cpp;h=e2d29c9c85ad7b2c8255a96617f8e068d9c1e5b0;hb=1d8c393b3a52defdabe34c17f1f370e71d317531;hp=1716adb37e54150fb7e59e74c704f895024d5fe1;hpb=2dd4d315bde6af849d68f1d3cd190ac3ec219527;p=modules%2Fshaper.git diff --git a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp index 1716adb37..e2d29c9c8 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp @@ -17,13 +17,12 @@ #include #include +#include #include #include #include #include -#include - #include #include #ifdef _DEBUG @@ -79,16 +78,16 @@ bool ExchangePlugin_ImportFeature::importFile(const std::string& theFileName) // Perform the import std::string anError; - TopoDS_Shape aShape; + std::shared_ptr aGeomShape; if (anExtension == "BREP" || anExtension == "BRP") { - aShape = BREPImport::Import(theFileName, anExtension, anError); + aGeomShape = BREPImport(theFileName, anExtension, anError); } else if (anExtension == "STEP" || anExtension == "STP") { - aShape = STEPImport::Import(theFileName, anExtension, anError); + aGeomShape = STEPImport(theFileName, anExtension, anError); } else if (anExtension == "IGES" || anExtension == "IGS") { - aShape = IGESImport::Import(theFileName, anExtension, anError); + aGeomShape = IGESImport(theFileName, anExtension, anError); } // Check if shape is valid - if ( aShape.IsNull() ) { + if ( aGeomShape->isNull() ) { const static std::string aShapeError = "An error occurred while importing " + theFileName + ": " + anError; setError(aShapeError); @@ -99,8 +98,6 @@ bool ExchangePlugin_ImportFeature::importFile(const std::string& theFileName) std::string anObjectName = GeomAlgoAPI_Tools::File_Tools::name(theFileName); data()->setName(anObjectName); std::shared_ptr aResultBody = document()->createBody(data()); - std::shared_ptr aGeomShape(new GeomAPI_Shape); - aGeomShape->setImpl(new TopoDS_Shape(aShape)); //LoadNamingDS of the imported shape loadNamingDS(aGeomShape, aResultBody); @@ -116,9 +113,9 @@ void ExchangePlugin_ImportFeature::loadNamingDS( std::shared_ptr theResultBody) { //load result - theResultBody->store(theGeomShape); + theResultBody->getBodyBuilder()->store(theGeomShape); int aTag(1); std::string aNameMS = "Shape"; - theResultBody->loadFirstLevel(theGeomShape, aNameMS, aTag); + theResultBody->getBodyBuilder()->loadFirstLevel(theGeomShape, aNameMS, aTag); }