]> OCCT Git - occt-copy.git/commitdiff
stepcontrol write stream
authormahaidong <13501108114@163.com>
Fri, 14 May 2021 06:35:28 +0000 (14:35 +0800)
committerkgv <kgv@opencascade.com>
Wed, 26 May 2021 13:21:08 +0000 (16:21 +0300)
src/STEPControl/STEPControl_Writer.cxx
src/STEPControl/STEPControl_Writer.hxx

index 77153b5112118a74bf2d69698a553638b5d116ae..b2dbfd6ab10fff5036208080e4ce93a5668bc10d 100644 (file)
@@ -18,6 +18,8 @@
 #include <STEPControl_ActorWrite.hxx>
 #include <STEPControl_Controller.hxx>
 #include <StepData_StepModel.hxx>
+#include <StepData_Protocol.hxx>
+#include <StepData_StepWriter.hxx>
 #include <TopExp_Explorer.hxx>
 #include <TopoDS_Shape.hxx>
 #include <Transfer_FinderProcess.hxx>
@@ -152,6 +154,35 @@ IFSelect_ReturnStatus STEPControl_Writer::Write (const Standard_CString filename
 }
 
 
+//=======================================================================
+//function : WriteStream
+//purpose  : 
+//=======================================================================
+
+IFSelect_ReturnStatus STEPControl_Writer::WriteStream (std::ostream& theOStream)
+{
+
+  Handle_StepData_Protocol stepro = Handle_StepData_Protocol::DownCast( 
+           this->Model()->Protocol());
+
+  if (this->Model().IsNull() || this->Model()->Protocol().IsNull()) 
+      return IFSelect_RetFail;
+
+  StepData_StepWriter SW(this->Model());
+  SW.SendModel( stepro );
+
+  Standard_Boolean isGood = SW.Print( theOStream );
+
+  if( isGood )
+      return IFSelect_RetDone;
+  else
+      return IFSelect_RetFail;
+
+}
+
+
+
+
 //=======================================================================
 //function : PrintStatsTransfer
 //purpose  : 
index ab1df694bc961d628c7deb4c82734124b384d56b..81d60c195da79c03ab3504e990c66616d3b4e548 100644 (file)
@@ -93,7 +93,10 @@ public:
   
   //! Writes a STEP model in the file identified by filename.
   Standard_EXPORT IFSelect_ReturnStatus Write (const Standard_CString filename);
-  
+
+  //! Writes a STEP model in the std::ostream.
+  Standard_EXPORT IFSelect_ReturnStatus WriteStream ( std::ostream& theOStream );
   //! Displays the statistics for the
   //! last translation. what defines the kind of statistics that are displayed:
   //! - 0 gives general statistics   (number of translated roots,