SaveDocument Error, Alembic export

On 27/04/2017 at 08:26, xxxxxxxx wrote:


I am new to c4d API, and I have  a strange error when trying to use SaveDocument command, using alembic plugin. I am wondering if it's an error in C4D or if I do something wrong...

In a new C4d session/document (R17 or R18), I only create a cube and a cone. (cube is selected, cone is not)

Following that example:

I added a 'print', before and after changing the export settings.

import c4d
from c4d import gui
#Welcome to the world of Python
from c4d import documents, plugins
from c4d import documents, plugins, storage
def main() :
    # Get Alembic export plugin, 1028082 is its ID
    plug = plugins.FindPlugin(1028082, c4d.PLUGINTYPE_SCENESAVER)
    if plug is None:
    # Get a path to save the exported file
    filePath ="C:/temp/"
    op = {}
    # Send MSG_RETRIEVEPRIVATEDATA to Alembic export plugin
    if plug.Message(c4d.MSG_RETRIEVEPRIVATEDATA, op) :
        if "imexporter" not in op:
        # BaseList2D object stored in "imexporter" key hold the settings
        abcExport = op["imexporter"]
        if abcExport is None:
        print 'SELECTION BEFORE: ',  abcExport[c4d.ABCEXPORT_SELECTION_ONLY]
        # Change Alembic export settings
        abcExport[c4d.ABCEXPORT_SELECTION_ONLY] = True
        abcExport[c4d.ABCEXPORT_PARTICLES] = True
        abcExport[c4d.ABCEXPORT_PARTICLE_GEOMETRY] = True
        print 'SELECTION AFTER: ',  abcExport[c4d.ABCEXPORT_SELECTION_ONLY]
        # Finally export the document
        if documents.SaveDocument(doc, filePath, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, 1028082) :
            print "Document successfully exported to:"
            print filePath
            print "Export failed!"
if __name__=='__main__':

The error is:
1- If I didn't open the actual Alembic plugin UI yet (in my c4d session). It seems I can't update the preferences. IE:  Before = 0, then I set it to True, After = 0...

The export won't take into consideration the preferences I've tried to set up for abcExport[c4d.ABCEXPORT_SELECTION_ONLY]

2- If I manually open Alembic exporter UI (File --> Export --> Alembic)... I do not need to change anything, I do not need to export (I can cancell).

Then, I can execute my script, and the preferences I'll choose for abcExport[c4d.ABCEXPORT_SELECTION_ONLY] will be taken into consideration...

IE: Before = 0, then I set it to True, After = 1... or Before = 1, then I set it to False, After = 0

Any idea?

On 28/04/2017 at 03:00, xxxxxxxx wrote:


welcome to the Plugin Café forums 🙂

This was actually a known issue (and special for the selection only parameter). But it should have been fixed with version 18.030. I just tried your code here in 18.041 without problem. So I'm a bit confused, that you say, you can reproduce this in R18.

On 28/04/2017 at 08:20, xxxxxxxx wrote:

Hey thanks Andreas,

your right. I was using C4D R18.020 and just upgraded to R18.041.

It seems to work fine!