Salome HOME
Issue #529 : 4.07. Import IGES, export to BREP, STEP, IGES - Export BREP
authorSergey POKHODENKO <sergey.pokhodenko@opencascade.com>
Thu, 14 May 2015 12:05:43 +0000 (15:05 +0300)
committerSergey POKHODENKO <sergey.pokhodenko@opencascade.com>
Tue, 19 May 2015 07:58:19 +0000 (10:58 +0300)
src/ExchangePlugin/CMakeLists.txt
src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp
src/GeomAlgoAPI/CMakeLists.txt
src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.cpp [new file with mode: 0644]
src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.h [new file with mode: 0644]
src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.h

index dc2e3a9179499f8628d81bf74a5d39135d4e4b41..2440dd1292b8674ef2119d89e305a370505d7f45 100644 (file)
@@ -8,7 +8,7 @@ INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/Events
                     ${PROJECT_SOURCE_DIR}/src/GeomAPI
                     ${PROJECT_SOURCE_DIR}/src/GeomAlgoAPI
                     ${CAS_INCLUDE_DIRS}
-) 
+)
 
 SET(PROJECT_HEADERS
     ExchangePlugin.h
@@ -17,7 +17,7 @@ SET(PROJECT_HEADERS
     ExchangePlugin_ExportFeature.h
     ExchangePlugin_Validators.h
 )
+
 SET(PROJECT_SOURCES
     ExchangePlugin_Plugin.cpp
     ExchangePlugin_ImportFeature.cpp
index 57843ebc3ea5014fac06f08999a52aaf9bba5bb0..3ad9783e26d4e5b667268b89b31b0ee3358333ac 100644 (file)
@@ -3,12 +3,12 @@
 /*
  * ExchangePlugin_ExportFeature.cpp
  *
- *  Created on: Aug 28, 2014
- *      Author: sbh
+ *  Created on: May 14, 2015
+ *      Author: spo
  */
 
 #include <ExchangePlugin_ExportFeature.h>
-//#include <GeomAlgoAPI_BREPExport.h>
+#include <GeomAlgoAPI_BREPExport.h>
 //#include <GeomAlgoAPI_STEPExport.h>
 #include <GeomAlgoAPI_IGESExport.h>
 
@@ -107,7 +107,7 @@ bool ExchangePlugin_ExportFeature::exportFile(const std::string& theFileName,
   TopoDS_Shape aShape(theShape->impl<TopoDS_Shape>());
   bool aResult = true;
   if (aFormatName == "BREP") {
-//    aShape = BREPExport::Export(aFileName, aFormatName, anError, anUnknownLabel);
+    aResult = BREPExport::Export(aFileName, aFormatName, aShape, anError, anUnknownLabel);
   } else if (aFormatName == "STEP" || aFormatName == "STP") {
 //    aShape = STEPExport::Export(aFileName, aFormatName, anError, anUnknownLabel);
   } else if (aFormatName == "IGES") {
index 44dd3cb42af65031e1932d2b09585a1f7414f20c..2dfd6048f3a65622d397ce8487e4c025d3a2d230 100644 (file)
@@ -22,6 +22,7 @@ SET(PROJECT_HEADERS
     GeomAlgoAPI_BREPImport.h
     GeomAlgoAPI_STEPImport.h
     GeomAlgoAPI_IGESImport.h
+    GeomAlgoAPI_BREPExport.h
     GeomAlgoAPI_IGESExport.h
 )
 
@@ -41,6 +42,7 @@ SET(PROJECT_SOURCES
     GeomAlgoAPI_BREPImport.cpp
     GeomAlgoAPI_STEPImport.cpp
     GeomAlgoAPI_IGESImport.cpp
+    GeomAlgoAPI_BREPExport.cpp
     GeomAlgoAPI_IGESExport.cpp
 )
 
diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.cpp
new file mode 100644 (file)
index 0000000..0499c75
--- /dev/null
@@ -0,0 +1,31 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#include <GeomAlgoAPI_BREPExport.h>
+
+#include <BRepTools.hxx>
+#include <BRep_Builder.hxx>
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+//extern "C" {
+namespace BREPExport {
+bool Export(const TCollection_AsciiString& theFileName,
+            const TCollection_AsciiString&,
+            const TopoDS_Shape& theShape,
+            TCollection_AsciiString& theError, const TDF_Label&)
+{
+  #ifdef _DEBUG
+  std::cout << "Export BREP into file " << theFileName << std::endl;
+  #endif
+  if ( !BRepTools::Write( theShape, theFileName.ToCString() ) ) {
+    theError = "BREP Export failed";
+    return false;
+  }
+  return true;
+}
+
+}
+//}
diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.h b/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.h
new file mode 100644 (file)
index 0000000..90496b0
--- /dev/null
@@ -0,0 +1,30 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+/*
+ * GEOMALGOAPI_BREPExport.h
+ *
+ *  Created on: May 14, 2015
+ *      Author: spo
+ */
+
+#ifndef GEOMALGOAPI_BREPEXPORT_H_
+#define GEOMALGOAPI_BREPEXPORT_H_
+
+#include <GeomAlgoAPI.h>
+
+#include <TCollection_AsciiString.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TDF_Label.hxx>
+
+namespace BREPExport {
+
+/// Implementation of the export BREP files algorithms
+GEOMALGOAPI_EXPORT
+bool Export(const TCollection_AsciiString& theFileName,
+            const TCollection_AsciiString& theFormatName,
+            const TopoDS_Shape& theShape,
+            TCollection_AsciiString& theError, const TDF_Label&);
+
+}
+
+#endif /* GEOMALGOAPI_BREPEXPORT_H_ */
index 7a7f28d410189d10efdcb7c9428256d7ec9206ae..e52a263e78e76c251e3355f785b44c73a573d9b6 100644 (file)
@@ -18,7 +18,7 @@
 
 namespace IGESExport {
 
-/// Implementation of the import IGES files algorithms
+/// Implementation of the export IGES files algorithms
 GEOMALGOAPI_EXPORT
 bool Export(const TCollection_AsciiString& theFileName,
             const TCollection_AsciiString& theFormatName,