Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Using python to "hierarchize" objects

    Scheduled Pinned Locked Moved PYTHON Development
    1 Posts 0 Posters 144 Views
    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.
    • H Offline
      Helper
      last edited by

      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:

      https://drive.google.com/file/d/0Bw5GC4jhbEtLSy1qMnc1bkVTZFk/edit?usp=sharing

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

      -Nate

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