0023561: stepwrite and brepiges dont work with big path (over 150 simbols) of writing...
[occt.git] / src / XSDRAWIGES / XSDRAWIGES.cxx
index 4da5a13..56a29a8 100755 (executable)
@@ -431,7 +431,7 @@ static Standard_Integer brepiges (Draw_Interpretor& di, Standard_Integer n, cons
 
 //  Mode d emploi (K4B ->) : brepiges shape [+shape][ +shape] nomfic
 //   c a d tant qu il y a des + on ajoute ce qui suit
-  const char* ficnom = NULL;
+  const char* nomfic;
   Standard_Integer npris = 0;
 
   Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
@@ -442,7 +442,7 @@ static Standard_Integer brepiges (Draw_Interpretor& di, Standard_Integer n, cons
   for ( Standard_Integer i = 1; i < n; i++) {
     const char* nomvar = a[i];
     if (a[i][0] == '+') nomvar = &(a[i])[1];
-    else if (i > 1)  {  ficnom = a[i];  break;  }
+    else if (i > 1)  {  nomfic = a[i];  break;  }
     TopoDS_Shape Shape = DBRep::Get(nomvar);
     if      (ICW.AddShape (Shape)) npris ++;
     else if (ICW.AddGeom (DrawTrSurf::GetCurve   (nomvar)) ) npris ++;
@@ -459,40 +459,16 @@ static Standard_Integer brepiges (Draw_Interpretor& di, Standard_Integer n, cons
   progress->Show();
 
   di<<npris<<" Shapes written, giving "<<XSDRAW::Model()->NbEntities()<<" Entities"<<"\n";
-  di<<" Now, to write a file, command : writeall filename"<<"\n";
 
-  // creation du fichier de sortie
-
-  char nomfic[100] ;
-  Standard_Integer modepri = 0;
-  if (ficnom) {
-    modepri = 2;
-    strcpy (nomfic,ficnom);
-  }
-
-  if (!modepri) {
-    cout<<" Mode (0 End, 1 ->screen, 2 file) :"<<flush;
-    modepri = -1;
-    cin >> modepri; di << "Output mode " << modepri << "\n";
-  }
-
-  if (modepri == 0) return 0;
-  // Ecran
-  else if (modepri == 1) {
-    di << " Screen Output" << "\n";
-    //ICW.Write (cout);
-    Standard_SStream aSStream;
-    ICW.Write (aSStream);
-    di << aSStream;
+  if ( ! nomfic ) // delayed write
+  {
+    di<<" Now, to write a file, command : writeall filename"<<"\n";
+    return 0;
   }
 
-  //  ....                      WRITE (Fichier)                        ....
-  else if (modepri == 2) {
-    if (!ficnom)  { cout << " Output file name :" << flush;  cin  >> nomfic; }
-    di << " Output on file : " << nomfic << "\n";
-    if (ICW.Write(nomfic)) di<<" Write OK"<<"\n";
-    else                   di<<" Write KO"<<"\n";
-  }
+  // write file
+  if (! ICW.Write(nomfic)) di<<" Error: could not write file " << nomfic;
+  else                     di<<" File " << nomfic << " written";
 
   progress->EndScope();
   progress->Show();