+ add method to write/read BREP in binary format

This commit is contained in:
wmayer
2015-09-07 19:02:56 +02:00
parent 3665b77827
commit 7f9aa7b4a5
11 changed files with 88 additions and 1 deletions

View File

@@ -355,6 +355,26 @@ PyObject* TopoShapePy::exportBrep(PyObject *args)
Py_Return;
}
PyObject* TopoShapePy::exportBinary(PyObject *args)
{
char* input;
if (!PyArg_ParseTuple(args, "s", &input))
return NULL;
try {
// read binary brep
std::ofstream str(input, std::ios::out | std::ios::binary);
getTopoShapePtr()->exportBinary(str);
str.close();
}
catch (const Base::Exception& e) {
PyErr_SetString(PartExceptionOCCError,e.what());
return NULL;
}
Py_Return;
}
PyObject* TopoShapePy::dumpToString(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
@@ -430,6 +450,26 @@ PyObject* TopoShapePy::importBrep(PyObject *args)
Py_Return;
}
PyObject* TopoShapePy::importBinary(PyObject *args)
{
char* input;
if (!PyArg_ParseTuple(args, "s", &input))
return NULL;
try {
// read binary brep
std::ifstream str(input, std::ios::in | std::ios::binary);
getTopoShapePtr()->importBinary(str);
str.close();
}
catch (const Base::Exception& e) {
PyErr_SetString(PartExceptionOCCError,e.what());
return NULL;
}
Py_Return;
}
PyObject* TopoShapePy::importBrepFromString(PyObject *args)
{
char* input;