// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <Draw_ProgressIndicator.hxx>
#include <Draw.hxx>
#include <Draw_Interpretor.hxx>
-#include <Draw_ProgressIndicator.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
#include <Message_ProgressScope.hxx>
void Draw_ProgressIndicator::Reset()
{
Message_ProgressIndicator::Reset();
- if ( myShown ) {
+ if (myShown)
+ {
+ // eval will reset current string result - backup it beforehand
+ const TCollection_AsciiString aTclResStr (myDraw->Result());
myDraw->Eval ( "destroy .xprogress" );
+ *myDraw << aTclResStr;
myShown = Standard_False;
}
myBreak = Standard_False;
"/" << ( aTime - myStartTime ) / GetPosition() << " sec";
}
+ // eval will reset current string result - backup it beforehand
+ const TCollection_AsciiString aTclResStr (myDraw->Result());
if ( ! myShown ) {
char command[1024];
Sprintf ( command, "toplevel .xprogress -height 100 -width 410;"
aCommand << ".xprogress.bar coords progress_next 2 2 " << (1 + 400 * theScope.GetPortion()) << " 21;";
aCommand << ".xprogress.text configure -text \"" << aText.str() << "\";";
aCommand << "update";
+
myDraw->Eval (aCommand.str().c_str());
+ *myDraw << aTclResStr;
}
// Print textual progress info
static Standard_Address stopIndicator = 0;
return stopIndicator;
}
-
-
#include <DDocStd_DrawDocument.hxx>
#include <Draw.hxx>
#include <Draw_Interpretor.hxx>
+#include <Draw_ProgressIndicator.hxx>
#include <Message.hxx>
#include <IFSelect_SessionPilot.hxx>
#include <IGESCAFControl_Reader.hxx>
case 'l' : reader.SetLayerMode (mode); break;
}
}
+
+ Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di);
+ Message_ProgressScope aRootScope (aProgress->Start(), "IGES import", modfic ? 2 : 1);
+
IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
- if (modfic) readstat = reader.ReadFile (fnom.ToCString());
- else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
- if (readstat != IFSelect_RetDone) {
- if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon\n";
- else di<<"No model loaded\n";
+ if (modfic)
+ {
+ Message_ProgressScope aReadScope (aRootScope.Next(), "File reading", 1);
+ aReadScope.Show();
+ readstat = reader.ReadFile (fnom.ToCString());
+ }
+ else if (XSDRAW::Session()->NbStartingEntities() > 0)
+ {
+ readstat = IFSelect_RetDone;
+ }
+ if (readstat != IFSelect_RetDone)
+ {
+ if (modfic)
+ {
+ di<<"Could not read file "<<fnom.ToCString()<<" , abandon\n";
+ }
+ else
+ {
+ di<<"No model loaded\n";
+ }
return 1;
}
Draw::Set(argv[1],DD);
// di << "Document saved with name " << argv[1];
}
- if ( ! reader.Transfer ( doc ) ) {
+ if (!reader.Transfer (doc, aRootScope.Next()))
+ {
di << "Cannot read any relevant data from the IGES file\n";
return 1;
}
}
XSDRAW::SetNorm ("IGES");
-
+
+ TCollection_AsciiString fnom, rnom;
+ const Standard_Boolean modfic = XSDRAW::FileAndVar(argv[2], argv[1], "IGES", fnom, rnom);
+
// IGESControl_Writer ICW (Interface_Static::CVal("write.iges.unit"),
// Interface_Static::IVal("write.iges.brep.mode"));
+ Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di);
+ Message_ProgressScope aRootScope (aProgress->Start(), "IGES export", modfic ? 2 : 1);
+
IGESCAFControl_Writer writer ( XSDRAW::Session(), Standard_True );
if (argc == 4) {
Standard_Boolean mode = Standard_True;
case 'l' : writer.SetLayerMode (mode); break;
}
}
- writer.Transfer ( Doc );
+ writer.Transfer (Doc, aRootScope.Next());
- TCollection_AsciiString fnom, rnom;
- Standard_Boolean modfic = XSDRAW::FileAndVar(argv[2], argv[1], "IGES", fnom, rnom);
if (modfic)
{
- di << "Writig IGES model to file " << argv[2] << "\n";
- if ( writer.Write ( argv[2] ) ) di<<" Write OK\n";
- else di<<" Write failed\n";
+ Message_ProgressScope aWriteScope (aRootScope.Next(), "File writing", 1);
+ aWriteScope.Show();
+ di << "Writing IGES model to file " << argv[2] << "\n";
+ if (writer.Write (argv[2]))
+ {
+ di << " Write OK\n";
+ }
+ else
+ {
+ di << " Write failed\n";
+ }
}
else
{
}
}
+ Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di);
+ Message_ProgressScope aRootScope (aProgress->Start(), "STEP import", modfic ? 2 : 1);
+
IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
- if (modfic) readstat = reader.ReadFile (fnom.ToCString());
- else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
- if (readstat != IFSelect_RetDone) {
- if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon\n";
- else di<<"No model loaded\n";
+ if (modfic)
+ {
+ Message_ProgressScope aReadScope (aRootScope.Next(), "File reading", 1);
+ aReadScope.Show();
+ readstat = reader.ReadFile (fnom.ToCString());
+ }
+ else if (XSDRAW::Session()->NbStartingEntities() > 0)
+ {
+ readstat = IFSelect_RetDone;
+ }
+ if (readstat != IFSelect_RetDone)
+ {
+ if (modfic)
+ {
+ di << "Could not read file " << fnom << " , abandon\n";
+ }
+ else
+ {
+ di << "No model loaded\n";
+ }
return 1;
}
Draw::Set (aDocName, DD);
// di << "Document saved with name " << aDocName;
}
- if ( ! reader.Transfer ( doc ) ) {
+ if (!reader.Transfer (doc, aRootScope.Next()))
+ {
di << "Cannot read any relevant data from the STEP file\n";
return 1;
}
}
}
- if( !label.IsNull())
+
+ TCollection_AsciiString fnom, rnom;
+ const Standard_Boolean modfic = XSDRAW::FileAndVar(argv[2], argv[1], "STEP", fnom, rnom);
+
+ Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di);
+ Message_ProgressScope aRootScope (aProgress->Start(), "STEP export", modfic ? 2 : 1);
+ if (!label.IsNull())
{
di << "Translating label "<< argv[k]<<" of document " << argv[1] << " to STEP\n";
- if(!writer.Transfer ( label, mode, multifile ))
+ if (!writer.Transfer (label, mode, multifile, aRootScope.Next()))
{
di << "The label of document cannot be translated or gives no result\n";
return 1;
}
-
}
else
{
di << "Translating document " << argv[1] << " to STEP\n";
- if ( ! writer.Transfer ( Doc, mode, multifile ) ) {
+ if (!writer.Transfer (Doc, mode, multifile, aRootScope.Next()))
+ {
di << "The document cannot be translated or gives no result\n";
}
}
-
- TCollection_AsciiString fnom, rnom;
- Standard_Boolean modfic = XSDRAW::FileAndVar(argv[2], argv[1], "STEP", fnom, rnom);
+
if (modfic)
{
+ Message_ProgressScope aWriteScope (aRootScope.Next(), "File writing", 1);
+ aWriteScope.Show();
di << "Writing STEP file " << argv[2] << "\n";
IFSelect_ReturnStatus stat = writer.Write(argv[2]);
switch (stat) {