"""
HB_KnifeLine V1.1

Last Modified: 4/25/2016
Works with CINEMA 4D R16.050 and up.
Copyright: Holger Biebrach, www.c4dstuff.com

Name-US: HB_KnifeLine
Description-US: Activates Edge-mode and sets up Knife-Tool to do linecuts

Activates Edge-mode and sets up Knife-Tool to do linecuts

Video Tutorial:
https://youtu.be/Ki6I9sRdeUU?t=14m17s

Name-DE: HB_KnifeLine
Description-DE: Aktiviert Kanten Mode und Knifetool

ChangeLog:
6/11/2015 Release Version

4/25/2016 R18 Support

"""

import c4d
from c4d import documents, plugins
  
def tool():
    return c4d.plugins.GetToolData(doc, doc.GetAction())

def main():

    c4d.CallCommand(16351) # Edges
    c4d.CallCommand(431000163) # Line Cutter
    tool()[c4d.MDATA_KNIFELINE_SELECTED]=False
    tool()[c4d.MDATA_KNIFELINE_CUTPOLYS]=True
    tool()[c4d.MDATA_KNIFELINE_VISIBLE_ONLY]=True
    tool()[c4d.MDATA_KNIFELINE_SINGLE]=False
    tool()[c4d.MDATA_KNIFELINE_AUTOSNAP]=True
    

    #Snapping
    if (c4d.IsCommandChecked(440000121)):
        c4d.CallCommand(440000121) # Snapping on
   




if __name__=='__main__':
    main()
    c4d.EventAdd()