filter selection to exclude object duplicates before export

This commit is contained in:
Sergo 2016-06-08 22:53:24 -04:00 committed by wmayer
parent fa6c8805ba
commit dc17dbf510

View File

@ -606,10 +606,12 @@ void Application::exportTo(const char* FileName, const char* DocName, const char
}
std::stringstream str;
std::set<App::DocumentObject*> unique_objs;
str << "__objs__=[]" << std::endl;
for (std::vector<App::DocumentObject*>::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;