Knife Modeling Command



  • On 10/11/2014 at 07:58, xxxxxxxx wrote:

    I'm using SendModelingCommand() to apply the Knife Tool to some objects. But it does not seem like the
    modeling command supports all the options the actual Knife Tool does. For instance, I can not activate the
    generation of N-Gons, only cutting visible polygons or any but the "Line" mode.

    Check out the scene here. You can move the "Cut_Plane" around to change the cut position, and at some
    positions it creats NGons. Even if you activate the "NGons" option, it still creates NGons.

    The code I use to cut the object is

    def cut(obj, p1, p2, n1, n2, options={}) :
        data = c4d.BaseContainer()
        data.SetVector(c4d.MDATA_KNIFE_P1, p1)
        data.SetVector(c4d.MDATA_KNIFE_P2, p2)
        data.SetVector(c4d.MDATA_KNIFE_V1, n1)
        data.SetVector(c4d.MDATA_KNIFE_V2, n2)
        data.SetBool(c4d.MDATA_KNIFE_NGONS, bool(options.get('ngons')))
        data.SetBool(c4d.MDATA_KNIFE_VISIBLEONLY, bool(options.get('visible_only')))
        c4d.utils.SendModelingCommand(
            c4d.MCOMMAND_KNIFE, [obj], bc=data, doc=obj.GetDocument())
    

    Can I enabled NGons and Visible Only somehow?

    Thanks
    Niklas

    Edit : By the way, here's a nice post from Yannick with details about cutting.



  • On 11/11/2014 at 05:46, xxxxxxxx wrote:

    Hello,

    you are using the Knife command (MCOMMAND_KNIFE). The parameters you want to enable are parameters of the Knife tool (ID_MODELING_KNIFE_TOOL). Unfortunately this tool does not support  the usage of SendModellingCommand. The docs will be updated.

    Best wishes,
    Sebastian



  • On 13/11/2014 at 00:33, xxxxxxxx wrote:

    Hi Sebastian, thanks for the reply.
    Since the prefix of the symbols that need to be used (P1, P2, V1, V2),
    is the same as the other knife tool symbols, I thought it might work
    somehow. Unfortunate it does not :-(

    Best
    Niklas


Log in to reply