Salome HOME
Typo-fix by Kunda
[modules/geom.git] / src / XAO / XAO_BrepGeometry.cxx
index d4f902da9a96ed70274419bae14a3b4c9db41ea0..f59edc305ecf375b2fed54ce5c62571c59669e33 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -65,6 +65,25 @@ void BrepGeometry::setShapeString(const std::string& shape)
     initIds();
 }
 
+void BrepGeometry::writeShapeFile(const std::string& fileName)
+throw (XAO_Exception)
+{
+    bool res = BRepTools::Write(m_shape, fileName.c_str());
+    if (!res)
+        throw XAO_Exception(MsgBuilder() << "Cannot write BRep file: " << fileName);
+}
+
+void BrepGeometry::readShapeFile(const std::string& fileName)
+throw (XAO_Exception)
+ {
+    BRep_Builder builder;
+    bool res = BRepTools::Read(m_shape, fileName.c_str(), builder);
+    if (!res)
+        throw XAO_Exception(MsgBuilder() << "Cannot read BRep file: " << fileName);
+
+    initIds();
+}
+
 TopoDS_Shape BrepGeometry::getTopoDS_Shape()
 {
     return m_shape;
@@ -78,7 +97,7 @@ void BrepGeometry::setTopoDS_Shape(const TopoDS_Shape& shape)
 
 void BrepGeometry::initIds()
 {
-    // intialization of Ids
+    // initialization of Ids
     initListIds(TopAbs_VERTEX, m_vertices);
     initListIds(TopAbs_EDGE, m_edges);
     initListIds(TopAbs_FACE, m_faces);