diff --git a/src/STEPControl/STEPControl_Controller.cxx b/src/STEPControl/STEPControl_Controller.cxx index 0743319ed4..5521f9e80f 100644 --- a/src/STEPControl/STEPControl_Controller.cxx +++ b/src/STEPControl/STEPControl_Controller.cxx @@ -15,7 +15,6 @@ // gka 05.04.99 S4136: parameters definitions changed #include -#include #include #include #include diff --git a/src/STEPControl/STEPControl_Reader.cxx b/src/STEPControl/STEPControl_Reader.cxx index 3ef72df3cd..db7014213c 100644 --- a/src/STEPControl/STEPControl_Reader.cxx +++ b/src/STEPControl/STEPControl_Reader.cxx @@ -11,6 +11,7 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +#include #include #include #include @@ -101,6 +102,8 @@ IFSelect_ReturnStatus STEPControl_Reader::ReadFile(const Standard_CString filena Handle(StepData_StepModel) aStepModel = new StepData_StepModel; aStepModel->InternalParameters.InitFromStatic(); aStepModel->SetSourceCodePage(aStepModel->InternalParameters.ReadCodePage); + APIHeaderSection_MakeHeader aHeaderMaker; + aHeaderMaker.Apply(aStepModel); IFSelect_ReturnStatus status = IFSelect_RetVoid; try { @@ -143,6 +146,8 @@ IFSelect_ReturnStatus STEPControl_Reader::ReadFile(const Standard_CString file Handle(StepData_StepModel) aStepModel = new StepData_StepModel; aStepModel->InternalParameters = theParams; aStepModel->SetSourceCodePage(aStepModel->InternalParameters.ReadCodePage); + APIHeaderSection_MakeHeader aHeaderMaker; + aHeaderMaker.Apply(aStepModel); IFSelect_ReturnStatus status = IFSelect_RetVoid; try { @@ -185,6 +190,8 @@ IFSelect_ReturnStatus STEPControl_Reader::ReadStream(const Standard_CString theN Handle(StepData_StepModel) aStepModel = new StepData_StepModel; aStepModel->InternalParameters.InitFromStatic(); aStepModel->SetSourceCodePage(aStepModel->InternalParameters.ReadCodePage); + APIHeaderSection_MakeHeader aHeaderMaker; + aHeaderMaker.Apply(aStepModel); IFSelect_ReturnStatus status = IFSelect_RetVoid; try { @@ -228,6 +235,8 @@ IFSelect_ReturnStatus STEPControl_Reader::ReadStream(const Standard_CString th Handle(StepData_StepModel) aStepModel = new StepData_StepModel; aStepModel->InternalParameters = theParams; aStepModel->SetSourceCodePage(aStepModel->InternalParameters.ReadCodePage); + APIHeaderSection_MakeHeader aHeaderMaker; + aHeaderMaker.Apply(aStepModel); IFSelect_ReturnStatus status = IFSelect_RetVoid; try { diff --git a/src/STEPControl/STEPControl_Writer.cxx b/src/STEPControl/STEPControl_Writer.cxx index a061913a6f..2437a66de5 100644 --- a/src/STEPControl/STEPControl_Writer.cxx +++ b/src/STEPControl/STEPControl_Writer.cxx @@ -13,6 +13,7 @@ #include +#include #include #include #include @@ -140,10 +141,9 @@ IFSelect_ReturnStatus STEPControl_Writer::Transfer(const TopoDS_Shape& XSAlgo_ShapeProcessor::PrepareForTransfer(); // update unit info Model()->SetLocalLengthUnit(UnitsMethods::GetCasCadeLengthUnit()); } - if (!thesession->Model().IsNull()) - { - Handle(StepData_StepModel)::DownCast(thesession->Model())->InternalParameters = theParams; - } + Model()->InternalParameters = theParams; + APIHeaderSection_MakeHeader aHeaderMaker; + aHeaderMaker.Apply(Model()); Handle(STEPControl_ActorWrite) ActWrite = Handle(STEPControl_ActorWrite)::DownCast(WS()->NormAdaptor()->ActorWrite()); ActWrite->SetGroupMode( @@ -156,6 +156,13 @@ IFSelect_ReturnStatus STEPControl_Writer::Transfer(const TopoDS_Shape& IFSelect_ReturnStatus STEPControl_Writer::Write(const Standard_CString theFileName) { + Handle(StepData_StepModel) aModel = Model(); + if (aModel.IsNull()) + { + return IFSelect_RetFail; + } + APIHeaderSection_MakeHeader aHeaderMaker; + aHeaderMaker.Apply(aModel); return thesession->SendAll(theFileName); } @@ -177,6 +184,8 @@ IFSelect_ReturnStatus STEPControl_Writer::WriteStream(std::ostream& theOStream) StepData_StepWriter aWriter(aModel); aWriter.SendModel(aProtocol); + APIHeaderSection_MakeHeader aHeaderMaker; + aHeaderMaker.Apply(aModel); return aWriter.Print(theOStream) ? IFSelect_RetDone : IFSelect_RetFail; } diff --git a/src/STEPEdit/STEPEdit.cxx b/src/STEPEdit/STEPEdit.cxx index 54529afe29..ac875950b3 100644 --- a/src/STEPEdit/STEPEdit.cxx +++ b/src/STEPEdit/STEPEdit.cxx @@ -13,7 +13,6 @@ #include -#include #include #include #include @@ -38,8 +37,9 @@ Handle(Interface_Protocol) STEPEdit::Protocol() Handle(StepData_StepModel) STEPEdit::NewModel() { - APIHeaderSection_MakeHeader head; - return head.NewModel(STEPEdit::Protocol()); + Handle(StepData_StepModel) stepmodel = new StepData_StepModel; + stepmodel->SetProtocol(STEPEdit::Protocol()); + return stepmodel; } Handle(IFSelect_Signature) STEPEdit::SignType()