Navigation

    • Register
    • Login
        No matches found
    • Search
    1. Home
    2. ivodow
    I

    ivodow

    @ivodow

    1
    Reputation
    13
    Posts
    15
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    ivodow Follow

    Best posts made by ivodow

    RE: Write to C4D console in real time

    An answer to my initial question, for others who may encounter the same issue. This can be used in lieu of print()

    import maxon
    
    def ConsolePrint( *args ):
        # concatenate var args into a single, space separated string suitable for maxon.Loggers
        txt = " ".join(str(i) for i in args)
        maxon.Loggers.Python().Write( maxon.TARGETAUDIENCE.ALL, txt, maxon.MAXON_SOURCE_LOCATION(1), maxon.WRITEMETA.UI_SYNC_DRAW )
    
    if __name__ == "__main__":
    
       ConsolePrint( "Output" )
    
    posted in Cinema 4D SDK •

    Latest posts made by ivodow

    RE: Thinking Particles- How to Set "Settings"

    Okay, thank you again.

    posted in Cinema 4D SDK •
    RE: Thinking Particles- How to Set "Settings"

    Hi Manuel,

    Thank you for your answer, I appreciate it.

    So that in the future I can find these things myself, I tried searching searching your Python docs for TP_VIEWTYPE. No results were returned. I assume those #defines are drawn from a C++ header, so I tried searching for TP_VIEWTYPE here, also with no success.

    Where can I find full searchable API documentation for Cinema 4D? (Like that for Rhino Common)

    posted in Cinema 4D SDK •
    Thinking Particles- How to Set "Settings"

    In Simulate -> Thinking Particles -> TP Settings... there are a series of UI elements at the top of the General tab controlling global settings for the TP system:

    Max. Particles
    Force this Setting
    Show Objects
    View Type

    How do I set these from python? (I specifically need Max Particles and View Type.) I have been all over the docs and cannot seem to find them.

    Thank you.

    posted in Cinema 4D SDK •
    RE: Write to C4D console in real time

    An answer to my initial question, for others who may encounter the same issue. This can be used in lieu of print()

    import maxon
    
    def ConsolePrint( *args ):
        # concatenate var args into a single, space separated string suitable for maxon.Loggers
        txt = " ".join(str(i) for i in args)
        maxon.Loggers.Python().Write( maxon.TARGETAUDIENCE.ALL, txt, maxon.MAXON_SOURCE_LOCATION(1), maxon.WRITEMETA.UI_SYNC_DRAW )
    
    if __name__ == "__main__":
    
       ConsolePrint( "Output" )
    
    posted in Cinema 4D SDK •
    RE: Thinking Particles allocation failure in new document

    Thank for the additional information.
    So, would ExecutePasses() with the BUILDFLAGS_EXPORT flag set be typically called just before exporting to alembic (to be on the safe side)?

    posted in Cinema 4D SDK •
    RE: Write to C4D console in real time

    Here is a contrived minimal working example that demonstrates the issue. This is only intended to force the issue to occur. My actual code involves loading multiple >2 GB databases and building particle systems.

    Thank you.

    
    import c4d
    
    
    def long_process():
    
        fullpath = c4d.storage.LoadDialog( type = c4d.FILESELECTTYPE_IMAGES, title = "Select File > 10MB:" )
        if not fullpath:
            return
    
        for n in xrange( 10 ):
    
            cnt = 0
            with open( fullpath, 'rb') as f:
                while( True ):
                    ansi_byte = f.read(1)
                    if( ansi_byte == b'' ):
                        break
                    if( cnt % 100000 == 0 ):
                        print( "Scanned " + str(cnt) + " bytes..." )
                    cnt += 1
    
            print( "Pass: " + str(n) )
    
    
    if __name__ == "__main__":
    
        c4d.CallCommand( 13957 )
    
        print( "Start" )
    
        long_process()
    
        print( "End" )
    
        c4d.EventAdd()
    
    posted in Cinema 4D SDK •
    RE: Write to C4D console in real time

    I found c4d.CallCommand( 13957 ), which clears the console and posts any buffered lines.

    However, what I'd like to do is post the buffered lines without clearing. Is this possible?

    posted in Cinema 4D SDK •
    Write to C4D console in real time

    Hi,

    I have a script that takes a long time to complete, and I would like to keep an eye on progress.

    Is it possible for print() or WriteConsole() events to immediately be posted to the python console, rather than all posted after the script returns control to c4d? If not, is there another way in the c4d api to accomplish this?

    posted in Cinema 4D SDK •
    RE: Thinking Particles allocation failure in new document

    Manuel,

    Thank you very much for the workaround.

    Can you tell me more about what ExecutePasses() does, and when it should be normally be called? I am also having an issue where exporting large numbers of scripted particles to alembic (again, by scripting) is creating a nearly empty file. I see the flag BUILDFLAGS_EXPORT on ExecutePasses() and wonder if that might do the trick.

    posted in Cinema 4D SDK •
    RE: Thinking Particles allocation failure in new document

    I also tried creating the new document with c4d.CallCommand(12094). AllocParticle() failed with this approach as well.

    posted in Cinema 4D SDK •