Console Output

Hi,

Open CASCADE writes output to the console when importing e.g. a STEP file that looks like this:

... Step File Reading : test.stp
... STEP File Read ...
Elapsed time: 0 Hours 0 Minutes 0.00931294204656 Seconds
CPU user time: 0 seconds
CPU system time: 0 seconds
... Step File loaded ...
Elapsed time: 0 Hours 0 Minutes 0.0119157234358 Seconds
CPU user time: 0 seconds
CPU system time: 0 seconds
138 records (entities,sub-lists,scopes), 320 parameters

... Parameters prepared ... Elapsed time: 0 Hours 0 Minutes 0.019636403754
7 Seconds
CPU user time: 0 seconds
CPU system time: 0 seconds
... Objets analysed ...
Elapsed time: 0 Hours 0 Minutes 0.0225558484308 Seconds
CPU user time: 0 seconds
CPU system time: 0 seconds
STEP Loading done : 75 Entities

Is there any way to stop Open CASCADE doing this?
I couldn't find anything in the documentation about that.
I tried to redirect std::cout to some other file but this somehow only works if i build my application in release mode but not for the debug mode.

Would be glad if someone could help me out!

alzi

MikkoL's picture

Hello,

One possible solution is to use ios::rdbuf() as follows.

std::stringstream ss;
std::streambuf *ob = std::cout.rdbuf(ss.rdbuf());

// STEP stuff
writer.Transfer(solid, STEPControl_AsIs);
writer.Write("cylinder.step");

// ss.str() contains the output from STEPControl
std::cout.rdbuf(ob); // restore original buffer

ML