diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index 52f83e0853..02da32008c 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -606,10 +606,12 @@ void Application::exportTo(const char* FileName, const char* DocName, const char } std::stringstream str; + std::set unique_objs; str << "__objs__=[]" << std::endl; for (std::vector::iterator it = sel.begin(); it != sel.end(); ++it) { - str << "__objs__.append(FreeCAD.getDocument(\"" << DocName << "\").getObject(\"" - << (*it)->getNameInDocument() << "\"))" << std::endl; + if (unique_objs.insert(*it).second) + str << "__objs__.append(FreeCAD.getDocument(\"" << DocName << "\").getObject(\"" + << (*it)->getNameInDocument() << "\"))" << std::endl; } str << "import " << Module << std::endl;