Hello @Laëtitia
You can export and import molecules using the following functions:
#include "SAMSON.hpp"
...
SBNodeIndexer nodeIndexer;
SAMSON::getActiveDocument()->getNodes(nodeIndexer); // get an indexer of all nodes in the active document
SAMSON::exportToFile(nodeIndexer, "pathToMolecule/export.pdb"); // export these nodes to a file
SAMSON::getActiveDocument()->erase(); // close the active document
SAMSON::importFromFile("pathToMolecule/import.pdb"); // import a molecule from a file
Importers and exporters will be detected by SAMSON based on the extension of the filenames.