]> OCCT Git - occt.git/commitdiff
0022760: Regression in the method RWStl::WriteAscii V6_5_2
authorKGV <>
Fri, 21 Oct 2011 18:08:38 +0000 (18:08 +0000)
committerbugmaster <bugmaster@opencascade.com>
Mon, 5 Mar 2012 15:30:40 +0000 (19:30 +0400)
src/RWStl/RWStl.cxx
src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx

index 1abe9eb393a28c6851587e1fe6dbe113d41775a4..17e1ae8d142d09890d6562366ba9318cc6421ed2 100755 (executable)
@@ -248,6 +248,7 @@ Standard_Boolean RWStl::WriteAscii (const Handle(StlMesh_Mesh)& theMesh,
           x1, y1, z1,
           x2, y2, z2,
           x3, y3, z3);
+      buf += sval;
       theFile.Write (buf, buf.Length()); buf.Clear();
 
       // update progress only per 1k triangles
index 1eb7656d5bc4c9fe63d71fa083c9bbded8b84501..c8385f8b43b1cb403c3aab2bcd2cea596de2ea55 100755 (executable)
 static Standard_Integer writestl
 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
 {
-  if (argc<3) di << "wrong number of parameters"    << "\n";
+  if (argc<3 || argc>4) di << "Use: " << argv[0] << "shape file [ascii/binary (0/1) : 1 by default]" << "\n";
   else {
     TopoDS_Shape shape = DBRep::Get(argv[1]);
-    //     StlAPI_Writer writer;
-    //     writer.ASCIIMode() = Standard_False;
-    //     writer.Write (shape, "binary.stl");
-    StlAPI::Write(shape, argv[2],Standard_False); //now write in binary mode
+    Standard_Boolean anASCIIMode = Standard_False;
+    if (argc==4) {
+      Standard_Integer mode = atoi(argv[3]);
+      if (mode==0) anASCIIMode = Standard_True;
+    }
+    StlAPI::Write(shape, argv[2],anASCIIMode);
   }
   return 0;
 }
@@ -945,7 +947,7 @@ void  XSDRAWSTLVRML::InitCommands (Draw_Interpretor& theCommands)
   //XSDRAW::LoadDraw(theCommands);
 
   theCommands.Add ("writevrml", "shape file",__FILE__,writevrml,g);
-  theCommands.Add ("writestl",  "shape file",__FILE__,writestl,g);
+  theCommands.Add ("writestl",  "shape file [ascii/binary (0/1) : 1 by default]",__FILE__,writestl,g);
   theCommands.Add ("readstl",   "shape file",__FILE__,readstl,g);
   theCommands.Add ("loadvrml" , "shape file",__FILE__,loadvrml,g);
   theCommands.Add ("storevrml" , "shape file defl [type]",__FILE__,storevrml,g);