Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
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" )
Okay, thank you again.
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)
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.
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)?
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.
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()
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?
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?
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.
I also tried creating the new document with c4d.CallCommand(12094). AllocParticle() failed with this approach as well.