From 68bc5ed764de027cb1635cca7652ce980d123939 Mon Sep 17 00:00:00 2001 From: KGV <> Date: Fri, 21 Oct 2011 18:08:38 +0000 Subject: [PATCH] 0022760: Regression in the method RWStl::WriteAscii --- src/RWStl/RWStl.cxx | 1 + src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/RWStl/RWStl.cxx b/src/RWStl/RWStl.cxx index 1abe9eb393..17e1ae8d14 100755 --- a/src/RWStl/RWStl.cxx +++ b/src/RWStl/RWStl.cxx @@ -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 diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx index 1eb7656d5b..c8385f8b43 100755 --- a/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx +++ b/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx @@ -74,13 +74,15 @@ 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);