How to display a progress bar ?

Hello all,

I use OCC to load big IGES files and to make operation on the model and it works well. The only problem is that it is rather long and I would like to call back my progress bar system in my own application. My windowing and display system is not our occ but our own system. Is there any way to do that ?

Thank you in advance for your help!

Bernard

Stephane Routelous's picture

Hi Bernard,

the easiest solution is something like (taken from exoTKAD) :
if (!myFileName.IsEmpty())
{
OSD_Path thePath(myFileName);
OSD_File theFile(thePath);
if (theFile.Exists())
{
exotkGUI::ShowProgressBox();
exotkGUI::SetProgressBoxTitle("Reading IGES");
exotkGUI::SetProgressBoxText("Reading the file");
exotkGUI::SetProgressBoxRange(0,45);
exotkGUI::SetProgressBoxPosition(0);
IGESControl_Reader aReader;
IFSelect_ReturnStatus status = aReader.ReadFile(myFileName.ToCString());
exotkGUI::SetProgressBoxPosition(100);
if (status == IFSelect_RetDone)
{
// Root transfers
exotkGUI::SetProgressBoxText("Transfering the roots");
exotkGUI::SetProgressBoxRange(45,90);
exotkGUI::SetProgressBoxPosition(0);
aReader.TransferRoots();
exotkGUI::SetProgressBoxPosition(100);
Standard_Integer nbs = aReader.NbShapes();
exotkGUI::SetProgressBoxText("Getting the shapes");
exotkGUI::SetProgressBoxRange(90,100);
if (nbs != 0)
{
TopoDS_Shape aShape;
for (Standard_Integer i =1; i <= nbs; i++)
{
exotkGUI::SetProgressBoxPosition(i*100/nbs);
if (theEntities.IsNull())
{
theEntities = new exotkDS_HSequenceOfEntity();
}
aShape = aReader.Shape(i);
theEntities->Append(new exotkDS_Shape(aShape));
}
}
}
exotkGUI::HideProgressBox();
}
}

if you want to go deeper, you have to modify the OpenCASCADE sources, which is a pain in the a**.

HTH,

Stephane

ducelierin's picture

Thank you very much, I will try to study your answer carefully and to apply your suggestion.

Bernard.

Sparse's picture

Hi,Stephane,
Like Bernard, I also want to using the progress bar when import a iges file. I want to try in your way, but I can not find the ExotkGUI package, where is it? Or what should I include in the file in order to use that package? I am using the OCC 6.1.
Regards!
Sparse

Forum supervisor's picture

Hello Bernard,

Please take a look at the description of Progress Indicator in the Release Notes of Open CASCADE Technology 5.2 at http://www.opencascade.org/getocc/whatsnew/.

Best regards,
Forum Supervisor

Jansen Yu's picture

It seems it doesn't work in OCC6.2. When I set XProgress +g and XProgress +t and IgesRead doc nothing appeared. Is this normal?

Thanks,

Jansen