From 1f1a69c0a94dbf4cb4ed95ed48ccfebe0ad6a2c6 Mon Sep 17 00:00:00 2001 From: mahaidong <13501108114@163.com> Date: Fri, 14 May 2021 14:35:28 +0800 Subject: [PATCH] stepcontrol write stream --- src/STEPControl/STEPControl_Writer.cxx | 31 ++++++++++++++++++++++++++ src/STEPControl/STEPControl_Writer.hxx | 5 ++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/STEPControl/STEPControl_Writer.cxx b/src/STEPControl/STEPControl_Writer.cxx index 77153b5112..b2dbfd6ab1 100644 --- a/src/STEPControl/STEPControl_Writer.cxx +++ b/src/STEPControl/STEPControl_Writer.cxx @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include #include @@ -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 : diff --git a/src/STEPControl/STEPControl_Writer.hxx b/src/STEPControl/STEPControl_Writer.hxx index ab1df694bc..81d60c195d 100644 --- a/src/STEPControl/STEPControl_Writer.hxx +++ b/src/STEPControl/STEPControl_Writer.hxx @@ -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, -- 2.39.5