1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0032350: Data Exchange - STEPControl_Writer.writeStream(std::ostream)

STEPCAFControl_Writer::WriteStream(), STEPControl_Writer::WriteStream() - added interface for writing into stream.
STEPCAFControl_Reader::ReadStream() - added stream reading method (similar to STEPControl_Reader::ReadStream()).

Added option -stream to commands ReadStep, WriteStep, and testwritestep.
This commit is contained in:
mahaidong
2021-05-14 14:35:28 +08:00
committed by smoskvin
parent b77de43fb0
commit 3e06b70623
9 changed files with 465 additions and 209 deletions

View File

@@ -18,6 +18,9 @@
#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 <XSAlgo.hxx>
#include <XSAlgo_AlgoContainer.hxx>
@@ -147,14 +150,37 @@ IFSelect_ReturnStatus STEPControl_Writer::Transfer
//=======================================================================
//function : Write
//purpose :
//purpose :
//=======================================================================
IFSelect_ReturnStatus STEPControl_Writer::Write (const Standard_CString filename)
IFSelect_ReturnStatus STEPControl_Writer::Write (const Standard_CString theFileName)
{
return thesession->SendAll(filename);
return thesession->SendAll (theFileName);
}
//=======================================================================
//function : WriteStream
//purpose :
//=======================================================================
IFSelect_ReturnStatus STEPControl_Writer::WriteStream (std::ostream& theOStream)
{
Handle(StepData_StepModel) aModel = Model();
if (aModel.IsNull())
{
return IFSelect_RetFail;
}
Handle(StepData_Protocol) aProtocol = Handle(StepData_Protocol)::DownCast (aModel->Protocol());
if (aProtocol.IsNull())
{
return IFSelect_RetFail;
}
StepData_StepWriter aWriter (aModel);
aWriter.SendModel (aProtocol);
return aWriter.Print (theOStream)
? IFSelect_RetDone
: IFSelect_RetFail;
}
//=======================================================================
//function : PrintStatsTransfer

View File

@@ -88,10 +88,13 @@ public:
const STEPControl_StepModelType mode,
const Standard_Boolean compgraph = Standard_True,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Writes a STEP model in the file identified by filename.
Standard_EXPORT IFSelect_ReturnStatus Write (const Standard_CString filename);
Standard_EXPORT IFSelect_ReturnStatus Write (const Standard_CString theFileName);
//! 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,