Delete Layers?



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



  • 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



  • 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


Log in to reply