2009/9/6 Bryan Bishop <kanz...@gmail.com> > Hey all, > > I am still getting a lot of textpuke from STEPImporter in pythonOCC > (samples/Level2/DataExchange/import_step_single.py). This is kind of > annoying. I wouldn't mind being able to specify a flag or something to > get this sort of output, but honestly most of the time it's just in > the way. Anyone know how to turn it off? I tried changing sys.stdout > and sys.stderr to StringIO() but that didn't work. It seems that this > might be due to the way OCC works and not pythonOCC? Still, it would > be nice to hear of any ideas. > > ... Step File Reading : aube_pleine.stp > ... STEP File Read ... > Elapsed time: 0 Hours 0 Minutes 0.020116 Seconds > CPU user time: 0.01 seconds > CPU system time: 0 seconds > ... Step File loaded ... > Elapsed time: 0 Hours 0 Minutes 0.022101 Seconds > CPU user time: 0.01 seconds > CPU system time: 0 seconds > 1835 records (entities,sub-lists,scopes), 5548 parameters > > ... Parameters prepared ... Elapsed time: 0 Hours 0 Minutes > 0.02384 Seconds > CPU user time: 0.01 seconds > CPU system time: 0 seconds > ... Objets analysed ... > Elapsed time: 0 Hours 0 Minutes 0.029436 Seconds > CPU user time: 0.02 seconds > CPU system time: 0 seconds > STEP Loading done : 954 Entities > 1 root(s) > Number of shapes:0 > > - Bryan > http://heybryan.org/ > 1 512 203 0507 > > Hi Bryan,
There's no easy way to achieve what you requested. The messages display by the OCC STEP Importer are emitted from the C++ code to std::cout. And there's no redirection to sys.stdout. That means you cannot redirect these messages from python. As far as I know, there's no 'verbose' option in OCC or another way to control text output. I see two solutions for you: 1. Re-compile pythonOCC with undef CHRONOMESURE. Here is a part of code extracted from StepFile_Read.cxx: #ifdef CHRONOMESURE sout << " ... Objets analysed ... " << endl; c.Show(); n = stepmodel->NbEntities() ; sout << " STEP Loading done : " << n << " Entities" << endl; #endif I guess the CHRONOMESURE flag is et sup by default. A simple #undef should do the job. But it requires a full recompilation of the whole pythonocc. 2. Implement with SWIG a redirection of std::cout to sys.stdout. I found this interesting post: http://osdir.com/ml/programming.swig/2004-10/msg00038.html . I have absolutely no idea if it works, and how reliable it is. But it can be tested if you have a few free time. Regards, Thomas
_______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users