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

    Delete Layers?

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 412 Views 1 Watching
    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 16/07/2014 at 13:36, xxxxxxxx wrote:

      Theres lots of documentation on how to create and manipulate layers but is there no way to delete a layer? Just to be clear I don't mean deleting an object from a layer, just deleting the actual layer.

      Thanks for any help on this.

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 16/07/2014 at 16:43, xxxxxxxx wrote:

        Use Remove() the same way as deleting an object from the OM.

        import c4d  
        def main() :  
          root = doc.GetLayerObjectRoot()    #Gets the layer manager  
          LayersList = root.GetChildren()    #The actual layers in the manager  
            
          #Looks for a layer named myLayer  
          #Then deletes it if it's found  
          for layer in LayersList:     
              print layer.GetName()  
              if layer.GetName()== "myLayer":  
                  layer.Remove()  
                
          c4d.EventAdd()  
          
        if __name__=='__main__':  
          main()
        

        -ScottA

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 17/07/2014 at 07:28, xxxxxxxx wrote:

          Thanks Scott! I tried almost this same setup, only I did a noob move and forgot the EventAdd so I couldn't tell it was being deleted. OOPS! Thanks a bunch

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