Added SaveCopy command

This command saves a copy of the current document under a new name,
without modifying the document itself.

Available in menu File -> Save a Copy or from python with
FreeCAD.ActiveDocument.saveCopy(filename)
This commit is contained in:
Yorik van Havre
2015-09-02 13:38:14 -03:00
parent 0d9dc9414d
commit da2c497671
9 changed files with 113 additions and 2 deletions
+19
View File
@@ -88,6 +88,25 @@ PyObject* DocumentPy::saveAs(PyObject * args)
Py_Return;
}
PyObject* DocumentPy::saveCopy(PyObject * args)
{
char* fn;
if (!PyArg_ParseTuple(args, "s", &fn)) // convert args: Python->C
return NULL; // NULL triggers exception
if (!getDocumentPtr()->saveCopy(fn)) {
PyErr_Format(PyExc_ValueError, "Object attribute 'FileName' is not set");
return NULL;
}
Base::FileInfo fi(fn);
if (!fi.isReadable()) {
PyErr_Format(PyExc_IOError, "No such file or directory: '%s'", fn);
return NULL;
}
Py_Return;
}
PyObject* DocumentPy::load(PyObject * args)
{
char* filename=0;