diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp
index d75604d5b0..00a800cffd 100644
--- a/src/Gui/Document.cpp
+++ b/src/Gui/Document.cpp
@@ -2456,7 +2456,7 @@ MDIView *Document::setActiveView(const ViewProviderDocumentObject* vp, Base::Typ
/**
* @brief Document::setActiveWindow
* If this document is active and the view is part of it then it will be
- * activated. If the document is not active of the view is already active
+ * activated. If the document is not active or if the view is already active
* nothing is done.
* @param view
*/
diff --git a/src/Gui/DocumentPy.xml b/src/Gui/DocumentPy.xml
index d3fdeada96..da3a79186c 100644
--- a/src/Gui/DocumentPy.xml
+++ b/src/Gui/DocumentPy.xml
@@ -119,6 +119,16 @@ The active object of the document. Deprecated, use ActiveObject.
The active view of the document. Deprecated, use ActiveView.
+
+
+ createView(type) -> object or None
+
+Return a newly created view of a given type.
+
+type : str
+ Type name.
+
+
mdiViewsOfType(type) -> list of MDIView
diff --git a/src/Gui/DocumentPyImp.cpp b/src/Gui/DocumentPyImp.cpp
index c53832fdf1..ed89f6c7e2 100644
--- a/src/Gui/DocumentPyImp.cpp
+++ b/src/Gui/DocumentPyImp.cpp
@@ -254,6 +254,29 @@ PyObject* DocumentPy::activeView(PyObject *args)
PY_CATCH;
}
+PyObject* DocumentPy::createView(PyObject *args)
+{
+ char* sType;
+ if (!PyArg_ParseTuple(args, "s", &sType))
+ return nullptr;
+
+ Base::Type type = Base::Type::fromName(sType);
+ if (type.isBad()) {
+ PyErr_Format(PyExc_TypeError, "'%s' is not a valid type", sType);
+ return nullptr;
+ }
+
+ PY_TRY {
+ Gui::MDIView* pcView = getDocumentPtr()->createView(type);
+ if (pcView) {
+ return pcView->getPyObject();
+ } else {
+ Py_Return;
+ }
+ }
+ PY_CATCH;
+}
+
PyObject* DocumentPy::mdiViewsOfType(PyObject *args)
{
char* sType;