SAMSON Forum
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • SAMSON Connect
    • Get SAMSON

    Import new "version" of the molecule

    GUI
    3
    7
    4343
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Laëtitia
      Laëtitia last edited by

      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

      1 Reply Last reply Reply Quote 0
      • DmitriyMarin
        DmitriyMarin last edited by

        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.

        Dmitriy,
        The SAMSON Team, https://s-c.io

        1 Reply Last reply Reply Quote 1
        • Laëtitia
          Laëtitia last edited by

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

          Thanks a lot

          1 Reply Last reply Reply Quote 0
          • Laëtitia
            Laëtitia last edited by

            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?)

            1 Reply Last reply Reply Quote 0
            • Stephane
              Stephane last edited by

              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?

              1 Reply Last reply Reply Quote 0
              • Laëtitia
                Laëtitia last edited by

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

                1 Reply Last reply Reply Quote 0
                • Stephane
                  Stephane last edited by

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

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post