Extending Python Functions



  • On 27/07/2016 at 15:43, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R17 
    Platform:    Mac  ;  
    Language(s) :     C++  ;

    ---------
    Howdy,

    Well, I tried using the code posted in this thread (thanks) :
    https://plugincafe.maxon.net/topic/9583/12865_how-to-expose-an-object-function-done-in-c

    ... simply copying and pasting it into a test plugin, but I'm getting an error when I try to call the function from python:

    As you can see from the above screen shot, the console is saying that the initilization was successful, but I'm not familiar with python (never used it) so I don't know if I'm calling the added function correctly.

    What am I doing wrong?

    Adios,
    Cactus Dan



  • On 28/07/2016 at 02:20, xxxxxxxx wrote:

    Hi Cactus,

    seems like your image link is corrupt. At least for me, it displays the "no image" icon.

    For examples on extending the Python API, you might want to look into my APEX plugin.
    It implements a few Python functions from C++ (see the wiki).

    Cheers,
    Niklas



  • On 28/07/2016 at 02:33, xxxxxxxx wrote:

    Hi,

    The screenshot image displays fine for me.

    I think you're just missing the module name c4d.extendpyapi before HelloPython().
    So to call HelloPython() write c4d.extendpyapi.HelloPython()
    You can also import extendpyapi module with from c4d import extendpyapi and then just write extendpyapi.HelloPython()



  • On 28/07/2016 at 05:35, xxxxxxxx wrote:

    Howdy,

    AHA! That works! Thank you. 😉

    Adios,
    Cactus Dan


Log in to reply