Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Diff for selected atoms
diff --git a/avogadro/qtgui/interfacescript.cpp b/avogadro/qtgui/interfacescript.cpp
index f0ad088..c0c2141 100644
--- a/avogadro/qtgui/interfacescript.cpp
+++ b/avogadro/qtgui/interfacescript.cpp
@@ -458,6 +458,14 @@ bool InterfaceScript::insertMolecule(QJsonObject& json,
if (m_moleculeExtension == QLatin1String("None"))
return true;
+ // insert the selected atoms
+ QJsonArray selectedList;
+ for (Index i = 0; i < mol.atomCount(); ++i) {
+ if (molecule.atomSelected(i))
+ selectedlist.append(i);
+ }
+ json.insert("selectedatoms", selectedList;
+
Io::FileFormatManager& formats = Io::FileFormatManager::instance();
QScopedPointer<Io::FileFormat> format(
formats.newFormatFromFileExtension(m_moleculeExtension.toStdString()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment