Unsolved Converting ABC file to AEC using c4dpy?

Hello, I'm having a bit of trouble figuring out how to convert my ABC file to an AEC file using c4dpy. I wrote a script that works to convert it to a C4D file:

import c4d

def import_alembic_and_export_c4d(alembic_path):
    # Create a new document
    doc = c4d.documents.BaseDocument()

    # Load the Alembic file
    alembic_file = c4d.documents.LoadDocument(alembic_path, c4d.SCENEFILTER_MERGESCENE)
    if alembic_file is None:
        print("Failed to load Alembic file.")

    # Iterate through the objects in the Alembic file and add them to the target document
    for obj in alembic_file.GetObjects():
        doc.InsertObject(obj.Clone(), None, None)

     # Set the output path for the AEC file
    c4d_path = alembic_path.replace(".abc", ".c4d")

    c4d.documents.SaveDocument(doc, c4d_path, c4d.SAVEDOCUMENTFLAGS_NONE, c4d.FORMAT_C4DEXPORT)
    print(f"Exported C4D file: {c4d_path}")

if __name__ == "__main__":
    import sys
    import os
    if len(sys.argv) != 2:
        print("Usage: python import_export.py /path/to/alembic.abc")

    alembic_path = sys.argv[1]

Obviously, this creates a different type than I would like - is it possible to script something similar for creating an AEC file instead? I noticed there's no format option for AEC under saving the document, so I assume it would need to involve rendering instead?

This would be for Cinema4D 2023 for Windows.

Thank you!

Hi unfortually the possible way is to render the scene.
Within Cinema 4D you can call

rd = doc.GetActiveRenderData()

Which will simulate the click on the Save Project File... but this will open a File Selector dialog that you can't script.
So the only way is to render the scene via c4d.documents.RenderDocument.


Hi Maxime, thanks for the information - so just to clarify, I need to use RDATA_PROJECTFILESAVE in order to export as an AEC?