Import new "version" of the molecule



  • Hello,

    In the development on my app I would like at some moment to "reload" the view of the molecule. To import a new molecule and either forgetting about the one already displayed or save it somewhere. Which functions should I use?
    Thanks for help.
    Laëtitia



  • 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.



  • It works like a charm and it seems so natural once you've seen it once.

    Thanks a lot



  • Another related question, is there a way to have several windows to display several molecules? (each one sitting in a different window with it's individual internal coordinates?)



  • Hi Laëtitia, it's not yet possible to have several windows simultaneously. For now, the molecules should be opened in different documents. Would you like to have several views of the same document? Or be able to render a molecule by itself even without it being part of a document?



  • I was more thinking of the later, for example to see the initial state or another conformer.



  • Ok thanks! We'll see how we could do that!


Log in to reply
 

Looks like your connection to SAMSON Connect - Forum was lost, please wait while we try to reconnect.