Skip to content
  • Recent
  • Tags
  • Popular
  • SAMSON Connect
  • Get SAMSON
Collapse
SAMSON Forum
  1. Home
  2. Develop
  3. Modeling
  4. Get the position/index of an atom in the document view

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

Scheduled Pinned Locked Moved Modeling
3 Posts 2 Posters 3.7k Views
  • 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
    L
    Leonard
    wrote on last edited by
    #1

    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
    0
    • StephaneS
      StephaneS
      Stephane
      wrote on last edited by
      #2

      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
      1
      • L
        L
        Leonard
        wrote on last edited by
        #3

        Perfect thanks.

        1 Reply Last reply
        0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Recent
        • Tags
        • Popular
        • SAMSON Connect
        • Get SAMSON