From dc17dbf51077ba53915dd7ea8b25b88e2b63b022 Mon Sep 17 00:00:00 2001 From: Sergo Date: Wed, 8 Jun 2016 22:53:24 -0400 Subject: [PATCH] filter selection to exclude object duplicates before export --- src/Gui/Application.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index 52f83e0853c2..02da32008c4f 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;