Using python to "hierarchize" objects

  • On 30/06/2014 at 07:24, xxxxxxxx wrote:

    We've included a simplified scene file. What you are looking at is a small chunk of a protein molecule, imported into the scene using the ePMV plugin. Each visible object represents an atom, and each atom has an automatically generated name. Open up the 1crn_2:A_cpk null to see the list.
    We want to use the information in each name to group sets of similar atoms. The naming system is consistent no matter what protein is imported. We want to group items that share the first nine characters of their name…e.g., the first 8 objects in the file start with "S.2.0.Y44".

    Let's assume the user has selected the null object 1crn_2:A_cpk. This is what we want the script to do:

    For each set of atoms under the selected null object that share the first nine characters of their name,
    ~Find the atom whose name includes ".CB"
    ~Convert that ".CB" atom to a null object and name it with the 7th, 8th and 9th characters of the name (e.g., Y44)
    ~Place that new null object under the null that was originally selected (e.g., 1crn_2:A_cpk)
    ~Group the set of atoms (that share the first nine characters of their name) under this new null object

    Our scene file can be downloaded from:

    We really appreciate your help, as this will help us move forward with the majority of our project!


Log in to reply