SOLVED Mirror without duplicate using `MCOMMAND_MIRROR`

Hello guys,
It's something weird with MCOMMAND_MIRROR in S22.

This script (thanks to m_adam) duplicates and mirrors the object.

import c4d


def main():
    # Checks if selected object is valid
    if op is None:
        raise ValueError("op is none, please select one object.")

    # Defines some general settings, take care MDATA_MIRROR_VALUE, MDATA_MIRROR_SYSTEM and MDATA_MIRROR_PLANE
    settings = c4d.BaseContainer()
    settings[c4d.MDATA_MIRROR_DUPLICATE] = True
    settings[c4d.MDATA_MIRROR_SELECTIONS] = True
    settings[c4d.MDATA_MIRROR_ONPLANE] = True
    settings[c4d.MDATA_MIRROR_WELD] = True
    settings[c4d.MDATA_MIRROR_TOLERANCE] = 0.01

    # Corresponds to MDATA_MIRROR_VALUE, MDATA_MIRROR_SYSTEM and MDATA_MIRROR_PLANE
    value = 1000.0
    system = 0 # 0 = Object, 1 = World
    plane = 1 # 0 = XY, 1 = ZY, 2 = XZ

    if not 0 <= system < 2:
        raise ValueError("System can only be 0 or 1")

    # Buffer position vector
    pos = c4d.Vector()

    # Calculates Local (Object) coordinates
    if system == 0:
        globalMatrix = op.GetMg()
        if plane == 0:
            pos = globalMatrix.v3
        elif plane == 1:
            pos = globalMatrix.v1
        elif plane == 2:
            pos = globalMatrix.v2

        settings[c4d.MDATA_MIRROR_POINT] = globalMatrix.off + pos * value
        settings[c4d.MDATA_MIRROR_VECTOR] = pos

    # Calculates World coordinates
    elif system == 1:
        if plane == 0:
            pos = c4d.Vector(0.0, 0.0, 1.0)
        elif plane == 1:
            pos = c4d.Vector(1.0, 0.0, 0.0)
        elif plane == 2:
            pos = c4d.Vector(0.0, 1.0, 0.0)

        settings[c4d.MDATA_MIRROR_POINT] = pos * value
        settings[c4d.MDATA_MIRROR_VECTOR] = pos

    # Send the Modeling Operation
    res = c4d.utils.SendModelingCommand(c4d.MCOMMAND_MIRROR,
                                        [op],
                                        c4d.MODELINGCOMMANDMODE_ALL,
                                        settings,
                                        doc)

    c4d.EventAdd()


if __name__ == "__main__":
    main()


However, if I change

settings[c4d.MDATA_MIRROR_DUPLICATE] = True

to

settings[c4d.MDATA_MIRROR_DUPLICATE] = False

Script doesn't make anything.
In R20 it works.
Is it ok? Is there any way to just mirror the object without duplicate it?

P.S. Also, if I use Mirror (https://help.maxon.net/index.html#5633) with unchecked Duplicate Points everything works (in S22).

Cinema 4D S22.118 Windows 10

hi,

this look like a bug, I've opened a bug report

Cheers,
Manue

Hi, I've just tested this script in R23. It doesn't work 😞
One of my own scripts cannot work without this function.
Guys, you're really awesome! I love C4D, and hope you can fix it 😄

May be I can help somehow? I can upload the example scene, if you need it.

hi,

this will be probably fixed for futur updates but i doubt that this will be fixed for previous version.

The only way to go is to create your own function to mirror the polygon. This can be really long if you want to support uvs, texture, selection tag etc.

Sorry for the inconvenient.

Cheers,
Manuel

@m_magalhaes
Got it, thanks 🙂