delete layer

  • On 07/04/2017 at 09:56, xxxxxxxx wrote:

    I was curious about the proper way to delete a layer with python. I know you can get the layer and do layer.Remove() which does delete the layer but it leaves the scene in a weird state sometimes. If I have objects solo'd when I use layer.Remove() it leaves all objects solo'd even though the layer is gone.

    Is there a proper way to go about this?


  • On 10/04/2017 at 08:48, xxxxxxxx wrote:


    there's a small note in the Layer Manual in C++ docs that tells the trick.
    You basically need to clear the NBIT_SOLO_LAYER on the document, when removing a layer that has solo switched on.
    Like so:

    import c4d
    def main() :
        l = op.GetLayerObject(doc)
        if l is None:
        doc.ChangeNBit(c4d.NBIT_SOLO_LAYER, c4d.NBITCONTROL_CLEAR)
    if __name__=='__main__':

  • On 10/04/2017 at 12:01, xxxxxxxx wrote:

    That did it, thanks Andreas!

Log in to reply