From 8f6a653158b3160814a160f04e16ecfb2787dacf Mon Sep 17 00:00:00 2001 From: dpasukhi Date: Mon, 29 Jan 2024 11:02:23 +0000 Subject: [PATCH] 0033589: Data Exchange, Step Export - Using thread-safety interface ignore model schema Fixed issue with MakeHeader. Fix isn't for review or integration. Only for the internal usage. Need to adapt into work env. --- .../APIHeaderSection_MakeHeader.cxx | 2 +- src/StepAP214/StepAP214_Protocol.cxx | 34 +++++++++++++++++++ src/StepAP214/StepAP214_Protocol.hxx | 2 ++ src/StepData/StepData_Protocol.cxx | 9 +++-- src/StepData/StepData_Protocol.hxx | 8 +++++ 5 files changed, 52 insertions(+), 3 deletions(-) diff --git a/src/APIHeaderSection/APIHeaderSection_MakeHeader.cxx b/src/APIHeaderSection/APIHeaderSection_MakeHeader.cxx index 9f90004ff9..1421261c5d 100644 --- a/src/APIHeaderSection/APIHeaderSection_MakeHeader.cxx +++ b/src/APIHeaderSection/APIHeaderSection_MakeHeader.cxx @@ -162,7 +162,7 @@ void APIHeaderSection_MakeHeader::Apply Handle(StepData_Protocol) stepro = Handle(StepData_Protocol)::DownCast ( model->Protocol()); if (!stepro.IsNull()) sch = new TCollection_HAsciiString - (stepro->SchemaName()); + (stepro->SchemaName(model)); if (!sch.IsNull()) schid->SetValue (1,sch); } header.AddItem(fs); diff --git a/src/StepAP214/StepAP214_Protocol.cxx b/src/StepAP214/StepAP214_Protocol.cxx index 16643aa178..8f3ad571d6 100644 --- a/src/StepAP214/StepAP214_Protocol.cxx +++ b/src/StepAP214/StepAP214_Protocol.cxx @@ -27,6 +27,7 @@ static Standard_CString schemaAP242DIS = "AP242_MANAGED_MODEL_BASED_3D_ENGINEERI #include +#include #include #include // Removed from CC1-Rev2 to Rev4 : @@ -1577,6 +1578,39 @@ Handle(Standard_Type)& atype) const } +//======================================================================= +//function : SchemaName +//purpose : +//======================================================================= +Standard_CString StepAP214_Protocol::SchemaName(const Handle(Interface_InterfaceModel)& theModel) const +{ + Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(theModel); + StepData_ConfParameters aParam; + if (!aModel.IsNull()) + { + aParam = aModel->InternalParameters; + } + switch (aModel->InternalParameters.WriteSchema) + { + case StepData_ConfParameters::WriteMode_StepSchema_AP214CD: + return schemaAP214CD; + break; + case StepData_ConfParameters::WriteMode_StepSchema_AP214DIS: + return schemaAP214DIS; + break; + case StepData_ConfParameters::WriteMode_StepSchema_AP203: + return schemaAP203; + break; + case StepData_ConfParameters::WriteMode_StepSchema_AP214IS: + return schemaAP214IS; + break; + case StepData_ConfParameters::WriteMode_StepSchema_AP242DIS: + return schemaAP242DIS; + break; + } + return ""; +} + //======================================================================= //function : SchemaName //purpose : diff --git a/src/StepAP214/StepAP214_Protocol.hxx b/src/StepAP214/StepAP214_Protocol.hxx index 988c55c8b5..1a6971d6f7 100644 --- a/src/StepAP214/StepAP214_Protocol.hxx +++ b/src/StepAP214/StepAP214_Protocol.hxx @@ -42,6 +42,8 @@ public: //! Returns a Case Number for each of the StepAP214 Entities Standard_EXPORT virtual Standard_Integer TypeNumber (const Handle(Standard_Type)& atype) const Standard_OVERRIDE; + Standard_EXPORT virtual Standard_CString SchemaName(const Handle(Interface_InterfaceModel)& theModel) const Standard_OVERRIDE; + Standard_EXPORT virtual Standard_CString SchemaName() const Standard_OVERRIDE; //! Returns count of Protocol used as Resources (level one) diff --git a/src/StepData/StepData_Protocol.cxx b/src/StepData/StepData_Protocol.cxx index 330299ccd7..3a5bd7859b 100644 --- a/src/StepData/StepData_Protocol.cxx +++ b/src/StepData/StepData_Protocol.cxx @@ -67,12 +67,17 @@ Standard_Integer StepData_Protocol::TypeNumber return 0; } - -Standard_CString StepData_Protocol::SchemaName () const +Standard_CString StepData_Protocol::SchemaName() const { return thename; } +Standard_CString StepData_Protocol::SchemaName (const Handle(Interface_InterfaceModel)& theModel) const +{ + (void)theModel; + return thename; +} + Handle(Interface_InterfaceModel) StepData_Protocol::NewModel () const { diff --git a/src/StepData/StepData_Protocol.hxx b/src/StepData/StepData_Protocol.hxx index 65f975efef..c20a791dd6 100644 --- a/src/StepData/StepData_Protocol.hxx +++ b/src/StepData/StepData_Protocol.hxx @@ -67,6 +67,14 @@ public: //! To be redefined by each sub-class //! Here, SchemaName returns "(DEFAULT)" //! was C++ : return const + Standard_EXPORT virtual Standard_CString SchemaName(const Handle(Interface_InterfaceModel)& theModel) const; + + //! Returns the Schema Name attached to each class of Protocol + //! To be redefined by each sub-class + //! Here, SchemaName returns "(DEFAULT)" + //! was C++ : return const + Standard_DEPRECATED("USED old static interface to extract active schema.\n"\ + "Recommended to use method with input model to extract from current session") Standard_EXPORT virtual Standard_CString SchemaName() const; //! Creates an empty Model for Step Norm