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

    Get the position/index of an atom in the document view

    Modeling
    2
    3
    2592
    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.
    • L
      Leonard last edited by

      Hello OneAngstrom :-),

      I have an app, where I would like to return an index or something that would identify a given atom of the document view. Since I don't know the names of the atoms in advances, I was thinking I can use the index the atom has when I search in:

      SAMSON::getActiveDocument()->getNodes(nodeIndexer, SBNode::IsType(SBNode::Atom)); 
      

      but I don't know if it is guaranteed that the order is the same as the order of the atoms in the document view.

      So to summaries I would like the following behavior:

      • the user opens a .sam
      • My apps provides an index/a number
      • The user knows which atom the app considers.

      Notw that it cannot be based on the atoms' coordinates since my app will performs minimization steps that constantly modifies the system's geometry.

      Thanks in advance,

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

        Hi Leo ;-). Yes, the atoms retrieved this way will always be in the same order as in the document view (precisely, getNodes collects nodes in a depth-first-search way).

        1 Reply Last reply Reply Quote 1
        • L
          Leonard last edited by

          Perfect thanks.

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