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

MAXON SDK Specialist

MAXON Registered Developer

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

MAXON SDK Specialist

MAXON Registered Developer

@m_magalhaes
Got it, thanks 🙂

Hello guys,
This bug is still exists in S24. I made a video to show how it worked before (R21) and now (S22, R23, S24).

https://vimeo.com/558586168

For test I used the script from this page. The only difference I made is decreased value from 1000.0 to 0. It's just for convenience.

This script should mirrors selected object, when settings[c4d.MDATA_MIRROR_DUPLICATE] is False. It works in R21 and doesn't work in any late releases.
Could you fix it? I'm still using R21 because of this bug 😞

Hi,

our developers are aware of the bug and i can't say when it will be fixed. I understand it's not pleasant for you.

Cheers,
Manuel

MAXON SDK Specialist

MAXON Registered Developer

Roger that, thanks again.
I wasn't sure that the developers were aware. Sorry for annoy you 🙂
Cheers

Hi kisaf,

if you switch in the SendModelingCommand from MODELINGCOMMANDMODE_ALL to MODELINGCOMMANDMODE_POLYGONSELECTION it should work until the mirror in object mode is fixed.

Regards
Fritz

@fritz thank you very much, it works!

Hi,

I've missed that one, thanks a lot @Fritz

Cheers,
Manuel

MAXON SDK Specialist

MAXON Registered Developer

Hi,

This have been fixe and will be available in a futur update.

Cheers,
Manuel

MAXON SDK Specialist

MAXON Registered Developer