Reading console output - possible?



  • Hi!

    For our render plugin we like to read in the C4D console at startup. In there is information about plugin version for example that we can cross-reference.

    Is there a way to access these lines? Or export it.

    In R20 there is new feature to export the console, that can be very useful. Only problem is that it only exports new lines.

    Hopefully there is another way to do this?:)

    All tips are welcome!



  • See here, https://developers.maxon.net/docs/Cinema4DCPPSDK/html/page_maxonapi_loggerinterface.html#page_maxonapi_loggerinterface_types

    Just a guess, but it seems, that you are able to strip down all logged lines and create a parser around that. Would be nice, if someone could confirm that.


  • Global Moderator

    Hi,

    @mp5gosu already pointed to the LoggerInterface manual, there the last code snippet is actually what you are looking for.

    Small request from our side: You may want to consider using tags to categorize your threads (as I did here now) to help to keep this forum tidy and searchable.

    Lastly, we have introduced the new Q&A workflow in this forum. I exemplary turned this thread into a question, to demonstrate this new feature. I hope you don't mind.

    Cheers,
    Andreas



  • Hi mp5gosu & Andreas,

    Thanks for the help! This should do the trick!

    I need to convert this to Python, since I don't know C++, should start learning that soon.

    Any help with this would be awesome of course!

    And thanks for the change to the new workflow, will keep this in mind!:)



  • Ok, so it is possible in c++.
    Is it also possible in python?
    I could not find anything in the manual.

    -Pim


  • Global Moderator

    Hi Pim,

    in Python this is currently not yet possible. While there are first pieces of MAXON API in Python in R20, it is far from complete yet. Expect this to improve during the next versions.

    Oh, one more thing:
    Please don't get me wrong, we are all new here in this forum, so I'd rather mention things multiple times then forgetting about it. Please make use of the forums tagging system. In this case for example, a Python tag could have changed the answers overall.

    Cheers,
    Andreas



  • @a_block
    I'm sorry. I will in future.

    Question: can you direct me to an example of calling a c++ function from Python.
    This c++ could then get me the console output in Python.


  • Global Moderator

    Hello Pim,

    no need to apologize, we are just trying to guide everybody with this new forum and how we think, we can make most of it. I hope you don't mind.

    Yannick just recently demonstrated, how to access C++ function from Python. See Add functions to python via C++ SDK [R20].

    Cheers,
    Andreas



  • Ok, I managed to do it in R20.
    Question is now is this also possible in R19.
    In the manual I did not find any reference to logger or logging.
    I could not find LoggerInterface.

    So, how to do this in R19?
    There are still a lot of users who uses R19!

    -Pim


  • Global Moderator

    Hello Pim,

    the LoggerInterface is all new in R20, based on technology of the new core. There are no plans to back-port this to R19. In R19 and before there is no similar access to the Console, so it is unfortunately not possible.

    Bye,
    Andreas



  • I already guessed so.
    Thanks, I think we can close this post.

    -Pim