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



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



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



  • Perfect thanks.


Log in to reply
 

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