1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

Data Exchange - Schema missed during export #343

Refactor model creating to apply schema based on DE parameters.
New model creating stage no more inject header info.
This commit is contained in:
Pasukhin Dmitry 2025-02-04 17:27:16 +01:00 committed by GitHub
parent 6c77143364
commit 10d1902820
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 25 additions and 8 deletions

View File

@ -15,7 +15,6 @@
// gka 05.04.99 S4136: parameters definitions changed
#include <APIHeaderSection_EditHeader.hxx>
#include <APIHeaderSection_MakeHeader.hxx>
#include <IFSelect_EditForm.hxx>
#include <IFSelect_SelectModelRoots.hxx>
#include <IFSelect_SelectSignature.hxx>

View File

@ -11,6 +11,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <APIHeaderSection_MakeHeader.hxx>
#include <DE_ShapeFixParameters.hxx>
#include <IFSelect_WorkLibrary.hxx>
#include <Interface_EntityIterator.hxx>
@ -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
{

View File

@ -13,6 +13,7 @@
#include <STEPControl_Writer.hxx>
#include <APIHeaderSection_MakeHeader.hxx>
#include <DE_ShapeFixParameters.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx>
@ -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;
}

View File

@ -13,7 +13,6 @@
#include <STEPEdit.hxx>
#include <APIHeaderSection_MakeHeader.hxx>
#include <IFSelect_SelectModelEntities.hxx>
#include <IFSelect_SelectModelRoots.hxx>
#include <IFSelect_SelectSignature.hxx>
@ -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()