0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / XSDRAWIGES / XSDRAWIGES.cxx
index ff6c717..ab174f7 100644 (file)
 
 //gka 06.01.99 S3767 new function TPSTAT (first version)
 //pdn 11.01.99 putting "return" statement for compilation on NT
-#include <XSDRAWIGES.ixx>
 
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Failure.hxx>
-#include <Interface_Static.hxx>
-
-#include <IGESControl_Writer.hxx>
+#include <BRepTools.hxx>
+#include <DBRep.hxx>
+#include <Draw_Appli.hxx>
+#include <Draw_ProgressIndicator.hxx>
+#include <DrawTrSurf.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_Surface.hxx>
+#include <IFSelect_Functions.hxx>
+#include <IFSelect_SessionPilot.hxx>
 #include <IGESControl_Controller.hxx>
-#include <IGESData_BasicEditor.hxx>
-
+#include <IGESControl_Reader.hxx>
+#include <IGESControl_Writer.hxx>
 #include <IGESData.hxx>
-#include <IGESData_Protocol.hxx>
-// #include <IGESData_IGESWriter.hxx>
-#include <IGESData_IGESEntity.hxx>         // pour igeslist
+#include <IGESData_BasicEditor.hxx>
+#include <IGESData_IGESEntity.hxx>
 #include <IGESData_IGESModel.hxx>
-
-#include <Interface_Check.hxx>
-#include <Interface_CheckTool.hxx>
-#include <Interface_CheckIterator.hxx>
-
-#include <stdio.h>
-#include <TCollection_HAsciiString.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Shape.hxx>
-
+#include <IGESData_Protocol.hxx>
+#include <IGESSelect_Activator.hxx>
 #include <IGESToBRep.hxx>
 #include <IGESToBRep_Actor.hxx>
 #include <IGESToBRep_Reader.hxx>
-
-#include <Geom_Curve.hxx>
-#include <Geom_Surface.hxx>
-
+#include <Interface_Check.hxx>
+#include <Interface_CheckIterator.hxx>
+#include <Interface_CheckTool.hxx>
+#include <Interface_InterfaceModel.hxx>
 #include <Interface_Macros.hxx>
+#include <Interface_Static.hxx>
 #include <Message.hxx>
 #include <Message_Messenger.hxx>
+#include <Message_ProgressSentry.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include <Standard_Failure.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <TColStd_MapIteratorOfMapOfTransient.hxx>
+#include <TColStd_MapOfTransient.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Shape.hxx>
+#include <Transfer_FinderProcess.hxx>
+#include <Transfer_IteratorOfProcessForTransient.hxx>
+#include <Transfer_TransferOutput.hxx>
+#include <Transfer_TransientProcess.hxx>
+#include <XSControl.hxx>
+#include <XSControl_WorkSession.hxx>
+#include <XSControl_TransferReader.hxx>
+#include <XSDRAW.hxx>
+#include <XSDRAWIGES.hxx>
 
-#include <Draw_Appli.hxx>
-#include <DrawTrSurf.hxx>
-#include <DBRep.hxx>
-//#include <GeometryTest.hxx>  essai CKY 4-AUT-1998
-//#include <BRepTest.hxx>      essai CKY 4-AUT-1998
-//#include <MeshTest.hxx>      essai CKY 4-AUT-1998
+#include <stdio.h>
 
-// Init functions
+namespace {
 
-#include <IGESSelect_Activator.hxx>
-#include <XSDRAW.hxx>
-#include <XSDRAW_Commands.hxx>
-#include <Transfer_TransientProcess.hxx>
-#include <Transfer_TransferOutput.hxx>
-#include <Transfer_FinderProcess.hxx>
-#include <XSControl_WorkSession.hxx>
+  //=======================================================================
+//function : WriteShape
+//purpose  : Creates a file Shape_'number'
+//=======================================================================
+void WriteShape(const TopoDS_Shape& shape, const Standard_Integer number)
+{
+  char fname[110];
+  sprintf(fname, "Shape_%d",number);
+  std::ofstream f(fname,std::ios::out);
+  std::cout << "Output file name : " << fname << std::endl;
+  f << "DBRep_DrawableShape\n";
+  
+  BRepTools::Write(shape, f);
+  f.close();
+}
 
-// + tplosttrim
-#include <IFSelect_SessionPilot.hxx>
-#include <XSControl.hxx>
-#include <Transfer_IteratorOfProcessForTransient.hxx>
-#include <TColStd_MapOfTransient.hxx>
-#include <IFSelect_Functions.hxx>
-#include <TColStd_MapIteratorOfMapOfTransient.hxx>
-#include <IGESControl_Reader.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Draw_ProgressIndicator.hxx>
-#include <TopExp_Explorer.hxx>
-#include <Message_ProgressSentry.hxx>
+TCollection_AsciiString XSDRAW_CommandPart
+  (Standard_Integer argc, const char** argv, const Standard_Integer argf)
+{
+  TCollection_AsciiString res;
+  for (Standard_Integer i = argf; i < argc; i ++) {
+    if (i > argf) res.AssignCat(" ");
+    res.AssignCat (argv[i]);
+  }
+  return res;
+}
+}
 
 //--------------------------------------------------------------
 // Function : igesbrep
 //--------------------------------------------------------------
-
 static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, const char** argv) 
 {
   DeclareAndCast(IGESControl_Controller,ctl,XSDRAW::Controller());
@@ -128,8 +141,8 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c
   progress->Show();
 
   if (readstat != IFSelect_RetDone) {
-    if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon"<<"\n";
-    else di<<"No model loaded"<<"\n";
+    if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon\n";
+    else di<<"No model loaded\n";
     return 1;
   }
 // Choice of treatment
@@ -142,35 +155,35 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c
     //mode OnlyVisible does not work.
     // nent = Reader.NbRootsForTransfer();
     if (!fromtcl) {
-      cout<<"Mode (0 End, 1 Visible Roots, 2 All Roots, 3 Only One Entity, 4 Selection) :"<<flush;
+      std::cout<<"Mode (0 End, 1 Visible Roots, 2 All Roots, 3 Only One Entity, 4 Selection) :"<<std::flush;
       modepri = -1;
       
 // amv 26.09.2003 : this is used to avoid error of enter's simbol        
       char str[80];                                                             
-      cin>>str;                                                                 
+      std::cin>>str;                                                                 
       modepri = Draw::Atoi(str);   
     }
 
     if (modepri == 0) {  //fin
-      di << "Bye and good luck! " << "\n";
+      di << "Bye and good luck! \n";
       break;
     } 
 
     else if (modepri <= 2) {  // 1 : Visible Roots, 2 : All Roots
-      di << "All Geometry Transfer"<<"\n";
-      di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
-      di<<"  To modify : command  param read.iges.bspline.continuity"<<"\n";
+      di << "All Geometry Transfer\n";
+      di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)\n";
+      di<<"  To modify : command  param read.iges.bspline.continuity\n";
       Handle(XSControl_WorkSession) thesession = Reader.WS();
       thesession->ClearContext();
-      XSDRAW::SetTransferProcess (thesession->MapReader());
+      XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
       progress->NewScope ( 80, "Translation" );
       progress->Show();
-      thesession->MapReader()->SetProgress ( progress );
+      thesession->TransferReader()->TransientProcess()->SetProgress ( progress );
       
       if (modepri == 1) Reader.SetReadVisible (Standard_True);
       Reader.TransferRoots();
       
-      thesession->MapReader()->SetProgress ( 0 );
+      thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
       progress->EndScope();
       progress->Show();
       // result in only one shape for all the roots
@@ -178,32 +191,32 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c
       di<<"Count of shapes produced : "<<Reader.NbShapes()<<"\n";
       Standard_Integer answer = 1;
       if (Reader.NbShapes() > 1) {
-       cout << " pass(0)  one shape for all (1)\n or one shape per root (2)\n + WriteBRep (one for all : 3) (one per root : 4) : " << flush;
+       std::cout << " pass(0)  one shape for all (1)\n or one shape per root (2)\n + WriteBRep (one for all : 3) (one per root : 4) : " << std::flush;
         answer = -1;
         //amv 26.09.2003                                                        
         char str_a[80];                                                         
-        cin >> str_a;                                                           
+        std::cin >> str_a;                                                           
         answer = Draw::Atoi(str_a);    
       }
       if ( answer == 0) continue;
       if ( answer == 1 || answer == 3) {
        TopoDS_Shape shape = Reader.OneShape();
        // save the shape
-       if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
+       if (shape.IsNull()) { di<<"No Shape produced\n"; continue; }
        char fname[110];
        Sprintf(fname, "%s", rnom.ToCString());
        di << "Saving shape in variable Draw : " << fname << "\n";
-       if (answer == 3) IGESToBRep::WriteShape (shape,1);
+       if (answer == 3) WriteShape (shape,1);
        try {
          OCC_CATCH_SIGNALS
          DBRep::Set(fname,shape);
        }
-       catch(Standard_Failure) {
+       catch(Standard_Failure const& anException) {
          di << "** Exception : ";
-         di << Standard_Failure::Caught()->GetMessageString();
-         di<<" ** Skip"<<"\n";
+         di << anException.GetMessageString();
+         di<<" ** Skip\n";
          di << "Saving shape in variable Draw : " << fname << "\n";
-         IGESToBRep::WriteShape (shape,1);
+         WriteShape (shape,1);
        }
       }
        
@@ -212,19 +225,19 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c
        for (Standard_Integer inum = 1; inum <= numshape; inum++) {
          // save all the shapes
          TopoDS_Shape shape = Reader.Shape(inum);
-         if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
+         if (shape.IsNull()) { di<<"No Shape produced\n"; continue; }
          char fname[110];
          Sprintf(fname, "%s_%d", rnom.ToCString(),inum);
          di << "Saving shape in variable Draw : " << fname << "\n";
-         if (answer == 4) IGESToBRep::WriteShape (shape,inum);
+         if (answer == 4) WriteShape (shape,inum);
          try {
            OCC_CATCH_SIGNALS
            DBRep::Set(fname,shape);
          }
-         catch(Standard_Failure) {
+         catch(Standard_Failure const& anException) {
            di << "** Exception : ";
-           di << Standard_Failure::Caught()->GetMessageString();
-           di<<" ** Skip"<<"\n";
+           di << anException.GetMessageString();
+           di<<" ** Skip\n";
          }
        }
       }
@@ -232,18 +245,18 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c
     }
 
     else if (modepri == 3) {  // One Entity
-      cout << "Only One Entity"<<endl;
-      cout<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<endl;
-      cout<<"  To modify : command  param read.iges.bspline.continuity"<<endl;
-      cout << " give the number of the Entity : " << flush;
+      std::cout << "Only One Entity"<<std::endl;
+      std::cout<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<std::endl;
+      std::cout<<"  To modify : command  param read.iges.bspline.continuity"<<std::endl;
+      std::cout << " give the number of the Entity : " << std::flush;
       nent = XSDRAW::GetEntityNumber();
 
-      if (!Reader.TransferOne (nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
+      if (!Reader.TransferOne (nent)) di<<"Transfer entity n0 "<<nent<<" : no result\n";
       else {
        nbs = Reader.NbShapes();
        char shname[30];  Sprintf (shname,"%s_%d",rnom.ToCString(),nent);
        di<<"Transfer entity n0 "<<nent<<" OK  -> DRAW Shape: "<<shname<<"\n";
-       di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
+       di<<"Now, "<<nbs<<" Shapes produced\n";
        TopoDS_Shape sh = Reader.Shape(nbs);
        DBRep::Set (shname,sh);
       }
@@ -258,20 +271,20 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c
 //   *r donne xst-model-roots (TOUTES racines)
 
       if( fromtcl && argv[3][0]=='*' && argv[3][1]=='\0' ) {         
-        di << "All Geometry Transfer"<<"\n";
-        di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
-        di<<"  To modify : command  param read.iges.bspline.continuity"<<"\n";
+        di << "All Geometry Transfer\n";
+        di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)\n";
+        di<<"  To modify : command  param read.iges.bspline.continuity\n";
         Handle(XSControl_WorkSession) thesession = Reader.WS();
         thesession->ClearContext();
-        XSDRAW::SetTransferProcess (thesession->MapReader());
+        XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
         progress->NewScope ( 80, "Translation" );
         progress->Show();
-        thesession->MapReader()->SetProgress ( progress );
+        thesession->TransferReader()->TransientProcess()->SetProgress ( progress );
       
         Reader.SetReadVisible (Standard_True);
         Reader.TransferRoots();
       
-        thesession->MapReader()->SetProgress ( 0 );
+        thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
         progress->EndScope();
         progress->Show();
         
@@ -285,12 +298,12 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c
           OCC_CATCH_SIGNALS
           DBRep::Set(fname,shape);
         }
-        catch(Standard_Failure) {
+        catch(Standard_Failure const& anException) {
           di << "** Exception : ";
-         di << Standard_Failure::Caught()->GetMessageString();
-         di<<" ** Skip"<<"\n";
+         di << anException.GetMessageString();
+         di<<" ** Skip\n";
           di << "Saving shape in variable Draw : " << fname << "\n";
-          IGESToBRep::WriteShape (shape,1);
+          WriteShape (shape,1);
         }                                                                             
         return 0;
       }
@@ -307,14 +320,14 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c
          list = XSDRAW::GetList (compart.ToCString());
        }
        if (list.IsNull()) {
-          di<<"No list defined. Give a selection name or * for all visible transferrable roots"<<"\n";
+          di<<"No list defined. Give a selection name or * for all visible transferrable roots\n";
           continue;
         }
       }
       else {
-       cout<<"Name of Selection :"<<flush;
+       std::cout<<"Name of Selection :"<<std::flush;
        list = XSDRAW::GetList();
-       if (list.IsNull()) { cout<<"No list defined"<<endl; continue; }
+       if (list.IsNull()) { std::cout<<"No list defined"<<std::endl; continue; }
       }
 
       Standard_Integer nbl = list->Length();
@@ -322,11 +335,11 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c
       if (nbl == 0) continue;
       while (answer) {
        if (!fromtcl) {
-         cout<<"Choice: 0 abandon  1 transfer all  2 with confirmation  3 list n0s ents :"<<flush;
+         std::cout<<"Choice: 0 abandon  1 transfer all  2 with confirmation  3 list n0s ents :"<<std::flush;
           answer = -1;
           // anv 26.09.2003                                                     
           char str_answer[80];                                                  
-          cin>>str_answer;                                                      
+          std::cin>>str_answer;                                                      
           answer = Draw::Atoi(str_answer);    
        }
        if (answer <= 0 || answer > 3) continue;
@@ -341,28 +354,28 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c
          Standard_Integer nbt = 0;
          Handle(XSControl_WorkSession) thesession = Reader.WS();
        
-         XSDRAW::SetTransferProcess (thesession->MapReader());
+         XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
           progress->NewScope ( 80, "Translation" );
           progress->Show();
-          thesession->MapReader()->SetProgress ( progress );
+          thesession->TransferReader()->TransientProcess()->SetProgress ( progress );
 
           Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 );
          for (Standard_Integer ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) {
          
            nent = Reader.Model()->Number(list->Value(ill));
            if (nent == 0) continue;
-           if (!Reader.TransferOne(nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
+           if (!Reader.TransferOne(nent)) di<<"Transfer entity n0 "<<nent<<" : no result\n";
            else {
              nbs = Reader.NbShapes();
              char shname[30];  Sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
              di<<"Transfer entity n0 "<<nent<<" OK  -> DRAW Shape: "<<shname<<"\n";
-             di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
+             di<<"Now, "<<nbs<<" Shapes produced\n";
              TopoDS_Shape sh = Reader.Shape(nbs);
              DBRep::Set (shname,sh);
               nbt++;
            }
          }
-         thesession->MapReader()->SetProgress ( 0 );
+         thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
           progress->EndScope();
           progress->Show();
          di<<"Nb Shapes successfully produced : "<<nbt<<"\n";
@@ -383,8 +396,8 @@ static Standard_Integer testread (Draw_Interpretor& di, Standard_Integer argc, c
 {
   if (argc != 3)                                                                                      
     {                                                                                             
-      di << "ERROR in " << argv[0] << "Wrong Number of Arguments."<<"\n";                     
-      di << " Usage : " << argv[0] <<" file_name shape_name"<< "\n";                          
+      di << "ERROR in " << argv[0] << "Wrong Number of Arguments.\n";                     
+      di << " Usage : " << argv[0] <<" file_name shape_name\n";                          
       return 1;                                                                                 
     }  
   IGESControl_Reader Reader;
@@ -392,11 +405,11 @@ static Standard_Integer testread (Draw_Interpretor& di, Standard_Integer argc, c
   IFSelect_ReturnStatus readstat =  Reader.ReadFile(filename);
   di<<"Status from reading IGES file "<<filename<<" : ";  
   switch(readstat) {                                                              
-    case IFSelect_RetVoid  : { di<<"empty file"<<"\n"; return 1; }            
-    case IFSelect_RetDone  : { di<<"file read"<<"\n";    break; }             
-    case IFSelect_RetError : { di<<"file not found"<<"\n";   return 1; }      
-    case IFSelect_RetFail  : { di<<"error during read"<<"\n";  return 1; }    
-    default  :  { di<<"failure"<<"\n";   return 1; }                          
+    case IFSelect_RetVoid  : { di<<"empty file\n"; return 1; }            
+    case IFSelect_RetDone  : { di<<"file read\n";    break; }             
+    case IFSelect_RetError : { di<<"file not found\n";   return 1; }      
+    case IFSelect_RetFail  : { di<<"error during read\n";  return 1; }    
+    default  :  { di<<"failure\n";   return 1; }                          
   }       
   Reader.TransferRoots();
   TopoDS_Shape shape = Reader.OneShape();
@@ -423,7 +436,7 @@ static Standard_Integer brepiges (Draw_Interpretor& di, Standard_Integer n, cons
                          Interface_Static::IVal("write.iges.brep.mode"));
   di<<"unit (write) : "<<Interface_Static::CVal("write.iges.unit")<<"\n";
   di<<"mode  write  : "<<Interface_Static::CVal("write.iges.brep.mode")<<"\n";
-  di<<"  To modifiy : command  param"<<"\n";
+  di<<"  To modifiy : command  param\n";
 
 //  Mode d emploi (K4B ->) : brepiges shape [+shape][ +shape] nomfic
 //   c a d tant qu il y a des + on ajoute ce qui suit
@@ -454,11 +467,11 @@ static Standard_Integer brepiges (Draw_Interpretor& di, Standard_Integer n, cons
   progress->NewScope(10,"Writing");
   progress->Show();
 
-  di<<npris<<" Shapes written, giving "<<XSDRAW::Model()->NbEntities()<<" Entities"<<"\n";
+  di<<npris<<" Shapes written, giving "<<XSDRAW::Model()->NbEntities()<<" Entities\n";
 
   if ( ! nomfic ) // delayed write
   {
-    di<<" Now, to write a file, command : writeall filename"<<"\n";
+    di<<" Now, to write a file, command : writeall filename\n";
     return 0;
   }
 
@@ -481,8 +494,8 @@ static Standard_Integer testwrite (Draw_Interpretor& di, Standard_Integer n, con
 {
   if (n != 3)                                                                                      
     {                                                                                             
-      di << "ERROR in " << a[0] << "Wrong Number of Arguments."<<"\n";                     
-      di << " Usage : " << a[0] <<" file_name shape_name"<< "\n";                          
+      di << "ERROR in " << a[0] << "Wrong Number of Arguments.\n";                     
+      di << " Usage : " << a[0] <<" file_name shape_name\n";                          
       return 1;                                                                                 
     }
   IGESControl_Writer Writer;
@@ -490,15 +503,15 @@ static Standard_Integer testwrite (Draw_Interpretor& di, Standard_Integer n, con
   TopoDS_Shape shape = DBRep::Get(a[2]); 
   Standard_Boolean ok = Writer.AddShape(shape);
   if(!ok){
-    di<<"Shape not add"<<"\n";
+    di<<"Shape not add\n";
     return 1;
   }
   
   if(!(Writer.Write(filename))){
-    di<<"Error on writing file"<<"\n";
+    di<<"Error on writing file\n";
     return 1;
   }
-  di<<"File Is Written"<<"\n"; 
+  di<<"File Is Written\n"; 
   return 0;
 }
 //--------------------------------------------------------------
@@ -510,12 +523,12 @@ static Standard_Integer testwrite (Draw_Interpretor& di, Standard_Integer n, con
 static Standard_Integer igesparam (Draw_Interpretor& di, Standard_Integer , const char** ) 
 {
 //  liste des parametres
-  di<<"List of parameters which control IGES :"<<"\n";
-  di<<"  unit : write.iges.unit\n  mode write : write.iges.brep.mode\n  spline_continuity (read) : read.iges.bspline.continuity\nSee definition by  defparam, read/edit value by  param"<<"\n";
+  di<<"List of parameters which control IGES :\n";
+  di<<"  unit : write.iges.unit\n  mode write : write.iges.brep.mode\n  spline_continuity (read) : read.iges.bspline.continuity\nSee definition by  defparam, read/edit value by  param\n";
   di<<"unit (write) : "<<Interface_Static::CVal("write.iges.unit")<<"\n";
   di<<"mode  write  : "<<Interface_Static::CVal("write.iges.brep.mode")<<"\n";
-  di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
-  di<<"\n"<<" To modifier, param nom_param new_val"<<"\n";
+  di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)\n";
+  di<<"\n To modifier, param nom_param new_val\n";
   return 0;
 }
 
@@ -532,7 +545,7 @@ static Standard_Integer XSDRAWIGES_tplosttrim (Draw_Interpretor& di, Standard_In
 //  Standard_Integer narg = pilot->NbWords();
   Standard_Integer narg = n;
 
-  Handle(Transfer_TransientProcess) TP = XSControl::Session(pilot)->MapReader();
+  const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
   TColStd_Array1OfAsciiString strarg(1, 3);
   TColStd_Array1OfAsciiString typarg(1, 3);
   strarg.SetValue(1,"xst-type(CurveOnSurface)");
@@ -541,7 +554,7 @@ static Standard_Integer XSDRAWIGES_tplosttrim (Draw_Interpretor& di, Standard_In
   typarg.SetValue(1,"IGESGeom_TrimmedSurface");
   typarg.SetValue(2,"IGESGeom_BoundedSurface");
   typarg.SetValue(3,"IGESSolid_Face");
-  if (TP.IsNull()) { di<<"No Transfer Read"<<"\n"; return 1; }
+  if (TP.IsNull()) { di<<"No Transfer Read\n"; return 1; }
   Standard_Integer nbFaces = 0, totFaces = 0 ;
   Handle(IFSelect_WorkSession) WS = pilot->Session(); 
   Transfer_IteratorOfProcessForTransient itrp = TP->AbnormalResult(); 
@@ -553,14 +566,14 @@ static Standard_Integer XSDRAWIGES_tplosttrim (Draw_Interpretor& di, Standard_In
       if(typarg.Value(k).Location(Arg,1,typarg.Value(k).Length()) != 0) break;
     }
   }   
-  if( k == 4) {di<< "Invalid argument"<<"\n"; return 0; }
+  if( k == 4) {di<< "Invalid argument\n"; return 0; }
   for(Standard_Integer j = 1 ; j <= 3; j++) {
     TColStd_MapOfTransient aMap;
     if(narg == 1) k=j;
     Handle(TColStd_HSequenceOfTransient) list = IFSelect_Functions::GiveList(pilot->Session(),strarg.Value(k).ToCString());
     if (!list.IsNull()) itrp.Filter (list);
     else {
-      di << "No untrimmed faces" << "\n";
+      di << "No untrimmed faces\n";
       return 0;
     }
     for (itrp.Start(); itrp.More(); itrp.Next()) {
@@ -577,30 +590,32 @@ static Standard_Integer XSDRAWIGES_tplosttrim (Draw_Interpretor& di, Standard_In
       }
     }
     if(nbFaces != 0) {
-      if( j == 1 ) di << "Number of untrimmed faces: " << "\n";
+      if( j == 1 ) di << "Number of untrimmed faces: \n";
       switch(k){
       case 1:  
-       di << "Trimmed Surface: " << "\n"; break;
+       di << "Trimmed Surface: \n"; break;
       case 2:
-       di << "Bounded Surface: " << "\n"; break;
+       di << "Bounded Surface: \n"; break;
       case 3:
-       di << "Face: " << "\n"; break;
+       di << "Face: \n"; break;
       }
 
       TColStd_MapIteratorOfMapOfTransient itmap;
+      Standard_SStream aTmpStream;
       for(itmap.Initialize(aMap); itmap.More(); itmap.Next()) {
-        XSDRAW::Model()->Print (itmap.Key(), Message::DefaultMessenger());
-        di << "  ";
+        XSDRAW::Model()->Print (itmap.Key(), aTmpStream);
+        aTmpStream << "  ";
       }
+      di << aTmpStream.str().c_str();
       di << "\n";
-      di << "\n" << "Number:"<< nbFaces << "\n";
+      di << "\nNumber:"<< nbFaces << "\n";
       totFaces += nbFaces;
     }
     if(narg > 1) break;
     nbFaces = 0;
   }
   
-  if(totFaces == 0) di << "No untrimmed faces" << "\n";
+  if(totFaces == 0) di << "No untrimmed faces\n";
   else              di << "Total number :" << totFaces << "\n";
   return 0;
 }
@@ -614,20 +629,13 @@ static Standard_Integer XSDRAWIGES_TPSTAT(Draw_Interpretor& di,Standard_Integer
   Handle(IFSelect_SessionPilot) pilot = XSDRAW::Pilot();
   Standard_Integer argc = n;//= pilot->NbWords();
   const Standard_CString arg1 = a[1];//pilot->Arg(1);
-  //IGESControl_Reader read; //(XSControl::Session(pilot),Standard_False);
-  Handle(Transfer_TransientProcess) TP= XSControl::Session(pilot)->MapReader();
-   IGESControl_Reader read; //(XSControl::Session(pilot),Standard_False);
-  //read.SetTransientProcess(TP);
+  const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
+  IGESControl_Reader read; //(XSControl::Session(pilot),Standard_False);
 //        ****    tpent        ****
-//  if (TP.IsNull()) { di<<"No Transfer Read"<<"\n"; return IFSelect_RetError;}
   Handle(Interface_InterfaceModel) model = TP->Model();
-  //Handle(Interface_InterfaceModel) model = read.Model();
-  if (model.IsNull()) {di<<"No Transfer Read"<<"\n"; return -1;}
- //DeclareAndCast(IGESData_IGESModel,modelig,model);
- // read.SetModel(modelig);
+  if (model.IsNull()) {di<<"No Transfer Read\n"; return -1;}
   Handle(XSControl_WorkSession) thesession = read.WS();
   thesession->SetMapReader(TP);
-  //read.SetModel(model);
   Standard_Integer mod1 = 0;
   if (argc > 1) {
     char a2 = arg1[1]; if (a2 == '\0') a2 = '!';
@@ -641,12 +649,12 @@ static Standard_Integer XSDRAWIGES_TPSTAT(Draw_Interpretor& di,Standard_Integer
     default  : mod1 = -2; break;
     }
   }
-  if (mod1 < -1) di<<"Unknown Mode"<<"\n";
+  if (mod1 < -1) di<<"Unknown Mode\n";
   if (mod1 < 0) {
     di<<"Modes available :\n"
-      <<"g : general    c : checks (count)  C (list)"<<"\n"
-      <<"r : number of CasCade resulting shapes"<<"\n"
-      <<"s : mapping between IGES entities and CasCade shapes"<<"\n";
+      <<"g : general    c : checks (count)  C (list)\n"
+      <<"r : number of CasCade resulting shapes\n"
+      <<"s : mapping between IGES entities and CasCade shapes\n";
     if (mod1 < -1) return -1;
     return 0;
   }
@@ -656,7 +664,7 @@ static Standard_Integer XSDRAWIGES_TPSTAT(Draw_Interpretor& di,Standard_Integer
 static Standard_Integer etest(Draw_Interpretor& di, Standard_Integer argc, const char** a)
 {
   if(argc < 3) {
-    di<<"etest igesfile shape"<<"\n";
+    di<<"etest igesfile shape\n";
     return 0;
   }
   IGESControl_Reader aReader;