For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

STEPCAFControl_Reader and Progress Indication

Dennis G.'s picture

Is there a way to receive progress information during the ReadFile and/or Transfer routine in STEPCAFControl_Reader?



Roman Lygin's picture

Hi Dennis,

If you mean a progress indicator, the following should work:
STEPCAFControl_Reader aReader = ...;
Handle(Message_ProgressIndicator) aProgressIndicator = aReader.Reader().WS()->MapReader()->GetProgress();

Hope this helps.

Dirk B's picture

Hello Roman and Dennis!
I think one should rather derive from Message_ProgressIndicator and call aReader.Reader().WS()->MapReader()->SetProgress(...) on a variable of the derived class. There is an example for this in the function stepread in XSDRAWSTEP.cxx. I have tried to implement my own progress indicator, but it doesn't work. Has anybody made some experience with this?



Roman Lygin's picture

Hi Dirk,

Yes, you first have to derive your own class from abstract Message_ProgressIndicator and set it into the translator objects. The code I used above is how to *retrieve* it assuming that it was set somewhere else before.

I successfully implemented my own indicator in the past (e.g. to show Windows progress bar inside the window status bar). OCC ships with an example you mentioned in XSDRAWSTEP.cxx. It is Draw_ProgressIndicator which is descendant implementation using Tcl widgets and output stream to report progress. There is a bug however in Open CASCADE 6.3.0 - the command to set/change this indicator in DRAW has not been added. Up to 6.2.1 progress indicator lived as XSDRAW_ProgressIndicator and there was a command XProgress. In 6.3.0 the indicator moved into lower Draw package, but XProgress equivalent did not get migrated.

What are your particular problem with your own progress indicator ?

Dirk B's picture

Hi Roman!
Here's my code:


# include
# include
# include

DEFINE_STANDARD_HANDLE (MyProgressIndicator, Message_ProgressIndicator)
class MyProgressIndicator : public Message_ProgressIndicator
virtual Standard_Boolean Show( const Standard_Boolean force );
DEFINE_STANDARD_RTTI (MyProgressIndicator)

#include "stdafx.h"
#include "myprogressindicator.h"

IMPLEMENT_STANDARD_HANDLE (MyProgressIndicator, Message_ProgressIndicator)
IMPLEMENT_STANDARD_RTTI (MyProgressIndicator, Message_ProgressIndicator)


MyProgressIndicator::MyProgressIndicator() :

Standard_Boolean MyProgressIndicator::Show( const Standard_Boolean force )
OutputDebugString( "MyProgressIndicator::Show was called\n" );
return true;

I then used

STEPCAFControl_Reader reader;
Handle(MyProgressIndicator) aPI = new MyProgressIndicator();
reader.Reader().WS()->MapReader()->SetProgress( aPI );

to install my indicator. Now I expected that the Show method is called when the indicator made some progress, but it never is called. What am I doing wrong?



Roman Lygin's picture

Hi Dirk,

Very quick comments - did not try the code below. I encourage you to look at XSDRAWSTEP.cxx to understand how the indicator is used.

1. You first need to set its scale (range)
aPI->SetScale (1, 100, 1);
2. Looking at STEPCAFControl_Reader.cxx I think OCC team did not (yet?) introduce the progress indicator into it, so your indicator will not be fully smoothly growing, and you will have to advance some phases manually, for instance:
aPI->NewScope(20, "Loading");
reader.ReadFile ("myfile.stp");
aPI->NewScope(80, "Translation");
reader.Transfer (aDoc);

3. by the way, you can declare a handle simpler than yo do. Use IMPLEMENT_STANDARD_RTTIEXT instead of IMPLEMENT_STANDARD_RTTI, and omit all IMPLEMENT_STANDARD_TYPE and IMPLEMENT_STANDARD_SUPERTYPE macro. That will do all the work.

Hope this helps.

Dirk B's picture

Roman, thanks for the quick reply, especially 3.! I tried your code and MyProgressIndicator::Show gets called 3 times, as expected. Too bad the indicator doesn't get updated from within STEPCAFControl_Reader.



Cauchy Ding's picture

Hi Dirk,

I modified the OCC iges and step I/O source, and add a Callback function into the class. I think OCC should provide this Callback Function when it's born, but what a pity it doesn't. The same thing happened in the faces sewing API.


Roman Lygin's picture

Please also see my recent post on the blog. Part 3 ( contains an example for IGES. STEP should be similar.

--- - blog on Open CASCADE

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.