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

0033483: Data Exchange - Static_Interface local instance for the model

StepData_StepParameters class created and used instead of Interface_Static
This commit is contained in:
ichesnok
2023-09-25 11:23:08 +01:00
committed by dpasukhi
parent 0435edfe54
commit b9fbc699b5
52 changed files with 1110 additions and 581 deletions

View File

@@ -33,7 +33,6 @@
#include <STEPConstruct_Assembly.hxx>
#include <STEPConstruct_ContextTool.hxx>
#include <STEPConstruct_Part.hxx>
#include <StepData_StepModel.hxx>
#include <StepGeom_Axis2Placement3d.hxx>
#include <StepRepr_NextAssemblyUsageOccurrence.hxx>
#include <StepShape_ShapeDefinitionRepresentation.hxx>
@@ -69,7 +68,8 @@ STEPConstruct_ContextTool::STEPConstruct_ContextTool (const Handle(StepData_Step
void STEPConstruct_ContextTool::SetModel (const Handle(StepData_StepModel)& aStepModel)
{
theAPD.Nullify(); //thePRPC.Nullify();
mySchema = aStepModel->InternalParameters.WriteSchema;
myProductName = aStepModel->InternalParameters.WriteProductName;
Standard_Integer i, nb = aStepModel->NbEntities();
for(i = 1; i<=nb && theAPD.IsNull(); i ++) {
Handle(Standard_Transient) ent = aStepModel->Value(i);
@@ -111,7 +111,7 @@ void STEPConstruct_ContextTool::AddAPD (const Standard_Boolean enforce)
Standard_Boolean noapd = theAPD.IsNull();
if (noapd || enforce) theAPD = new StepBasic_ApplicationProtocolDefinition;
switch (Interface_Static::IVal("write.step.schema")) { //j4
switch (mySchema) { //j4
default:
case 1:
theAPD->SetApplicationProtocolYear (1997);
@@ -147,7 +147,7 @@ void STEPConstruct_ContextTool::AddAPD (const Standard_Boolean enforce)
if (theAPD->Application().IsNull())
theAPD->SetApplication (new StepBasic_ApplicationContext);
Handle(TCollection_HAsciiString) appl;
switch (Interface_Static::IVal("write.step.schema")) { //j4
switch (mySchema) { //j4
default:
case 1:
case 2: appl = new TCollection_HAsciiString ( "core data for automotive mechanical design processes" );
@@ -567,8 +567,8 @@ void STEPConstruct_ContextTool::SetIndex (const Standard_Integer ind)
Handle(TCollection_HAsciiString) STEPConstruct_ContextTool::GetProductName () const
{
Handle(TCollection_HAsciiString) PdtName;
if (Interface_Static::IsSet("write.step.product.name"))
PdtName = new TCollection_HAsciiString(Interface_Static::CVal("write.step.product.name"));
if (!myProductName.IsEmpty())
PdtName = new TCollection_HAsciiString(myProductName);
else PdtName = new TCollection_HAsciiString("Product");
for ( Standard_Integer i=1; i <= myLevel.Length(); i++ ) {
@@ -596,7 +596,7 @@ Handle(TColStd_HSequenceOfTransient) STEPConstruct_ContextTool::GetRootsForPart
if ( ! SDRTool.PRPC().IsNull() ) seq->Append ( SDRTool.PRPC() );
// for AP203, add required product management data
if ( Interface_Static::IVal("write.step.schema") == 3 ) {
if ( mySchema == 3 ) {
theAP203.Init ( SDRTool );
seq->Append (theAP203.GetProductCategoryRelationship());
seq->Append (theAP203.GetCreator());
@@ -626,7 +626,7 @@ Handle(TColStd_HSequenceOfTransient) STEPConstruct_ContextTool::GetRootsForAssem
seq->Append ( assembly.ItemValue() );
// for AP203, write required product management data
if ( Interface_Static::IVal("write.step.schema") == 3 ) {
if ( mySchema == 3 ) {
theAP203.Init ( assembly.GetNAUO() );
seq->Append (theAP203.GetSecurity());
seq->Append (theAP203.GetClassificationOfficer());

View File

@@ -24,11 +24,11 @@
#include <TColStd_SequenceOfInteger.hxx>
#include <STEPConstruct_AP203Context.hxx>
#include <StepData_Factors.hxx>
#include <StepData_StepModel.hxx>
#include <Standard_Integer.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
class StepBasic_ApplicationProtocolDefinition;
class StepGeom_Axis2Placement3d;
class StepData_StepModel;
class TCollection_HAsciiString;
class STEPConstruct_Part;
class STEPConstruct_Assembly;
@@ -143,6 +143,8 @@ private:
STEPConstruct_AP203Context theAP203;
Handle(StepGeom_Axis2Placement3d) myAxis;
StepData_Factors myGlobalFactor;
StepData_ConfParameters::WriteMode_StepSchema mySchema;
TCollection_AsciiString myProductName;
};

View File

@@ -26,6 +26,7 @@
#include <StepBasic_ProductDefinitionFormationWithSpecifiedSource.hxx>
#include <StepBasic_ProductType.hxx>
#include <STEPConstruct_Part.hxx>
#include <StepData_StepModel.hxx>
#include <StepRepr_ProductDefinitionShape.hxx>
#include <StepShape_ShapeDefinitionRepresentation.hxx>
#include <StepShape_ShapeRepresentation.hxx>
@@ -56,10 +57,11 @@ STEPConstruct_Part::STEPConstruct_Part()
void STEPConstruct_Part::MakeSDR(const Handle(StepShape_ShapeRepresentation)& SR,
const Handle(TCollection_HAsciiString)& aName,
const Handle(StepBasic_ApplicationContext)& AC)
const Handle(StepBasic_ApplicationContext)& AC,
Handle(StepData_StepModel)& theStepModel)
{
// get current schema
Standard_Integer schema = Interface_Static::IVal("write.step.schema");
const Standard_Integer schema = theStepModel->InternalParameters.WriteSchema;
// create PC
Handle(StepBasic_ProductContext) PC;
@@ -142,7 +144,7 @@ void STEPConstruct_Part::MakeSDR(const Handle(StepShape_ShapeRepresentation)& SR
// and an associated PRPC
Handle(TCollection_HAsciiString) PRPCName;
switch (Interface_Static::IVal("write.step.schema")) {
switch (theStepModel->InternalParameters.WriteSchema) {
default:
case 1:
myPRPC = new StepBasic_ProductType;

View File

@@ -31,6 +31,7 @@ class StepBasic_ProductDefinitionContext;
class StepBasic_Product;
class StepBasic_ProductDefinitionFormation;
class StepBasic_ProductDefinition;
class StepData_StepModel;
class StepRepr_ProductDefinitionShape;
@@ -47,7 +48,10 @@ public:
Standard_EXPORT STEPConstruct_Part();
Standard_EXPORT void MakeSDR (const Handle(StepShape_ShapeRepresentation)& aShape, const Handle(TCollection_HAsciiString)& aName, const Handle(StepBasic_ApplicationContext)& AC);
Standard_EXPORT void MakeSDR (const Handle(StepShape_ShapeRepresentation)& aShape,
const Handle(TCollection_HAsciiString)& aName,
const Handle(StepBasic_ApplicationContext)& AC,
Handle(StepData_StepModel)& theStepModel);
Standard_EXPORT void ReadSDR (const Handle(StepShape_ShapeDefinitionRepresentation)& aShape);

View File

@@ -228,7 +228,8 @@ Handle(StepVisual_StyledItem) STEPConstruct_Styles::AddStyle (const TopoDS_Shape
//=======================================================================
Standard_Boolean STEPConstruct_Styles::CreateMDGPR (const Handle(StepRepr_RepresentationContext) &Context,
Handle(StepVisual_MechanicalDesignGeometricPresentationRepresentation)& Repr)
Handle(StepVisual_MechanicalDesignGeometricPresentationRepresentation)& Repr,
Handle(StepData_StepModel)& theStepModel)
{
if ( myStyles.Extent() <1 ) return Standard_False;
@@ -246,7 +247,7 @@ Standard_Boolean STEPConstruct_Styles::CreateMDGPR (const Handle(StepRepr_Repres
// Model()->AddWithRefs ( Repr ); add into the model upper
// for AP203, add subschema name
if ( Interface_Static::IVal("write.step.schema") ==3 ) {
if ( theStepModel->InternalParameters.WriteSchema == 3 ) {
APIHeaderSection_MakeHeader mkHdr ( Handle(StepData_StepModel)::DownCast ( Model() ) );
Handle(TCollection_HAsciiString) subSchema =
new TCollection_HAsciiString ( "SHAPE_APPEARANCE_LAYER_MIM" );

View File

@@ -96,7 +96,9 @@ public:
//! Create MDGPR, fill it with all the styles previously defined,
//! and add it to the model
Standard_EXPORT Standard_Boolean CreateMDGPR (const Handle(StepRepr_RepresentationContext)& Context, Handle(StepVisual_MechanicalDesignGeometricPresentationRepresentation)& MDGPR);
Standard_EXPORT Standard_Boolean CreateMDGPR (const Handle(StepRepr_RepresentationContext)& Context,
Handle(StepVisual_MechanicalDesignGeometricPresentationRepresentation)& MDGPR,
Handle(StepData_StepModel)& theStepModel);
//! Create MDGPR, fill it with all the styles previously defined,
//! and add it to the model

View File

@@ -35,6 +35,7 @@
#include <StepBasic_SiUnitAndVolumeUnit.hxx>
#include <STEPConstruct_UnitContext.hxx>
#include <StepData_Factors.hxx>
#include <StepData_StepModel.hxx>
#include <StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx.hxx>
#include <StepRepr_GlobalUncertaintyAssignedContext.hxx>
#include <StepRepr_GlobalUnitAssignedContext.hxx>
@@ -64,6 +65,7 @@ STEPConstruct_UnitContext::STEPConstruct_UnitContext()
//=======================================================================
void STEPConstruct_UnitContext::Init(const Standard_Real Tol3d,
const Handle(StepData_StepModel)& theModel,
const StepData_Factors& theLocalFactors)
{
done = Standard_True;
@@ -82,7 +84,7 @@ void STEPConstruct_UnitContext::Init(const Standard_Real Tol3d,
Standard_Boolean hasPref = Standard_True;
StepBasic_SiPrefix siPref = StepBasic_spMilli;
Standard_Real aScale = 1.;
switch (Interface_Static::IVal("write.step.unit"))
switch (theModel->InternalParameters.WriteUnit)
{
case 1: uName = "INCH"; aScale = 25.4; break;
default:

View File

@@ -25,6 +25,7 @@
#include <Standard_CString.hxx>
#include <StepBasic_SiPrefix.hxx>
class StepData_Factors;
class StepData_StepModel;
class StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx;
class StepRepr_GlobalUnitAssignedContext;
class StepBasic_NamedUnit;
@@ -47,6 +48,7 @@ public:
//! Creates new context (units are MM and radians,
//! uncertainty equal to Tol3d)
Standard_EXPORT void Init (const Standard_Real Tol3d,
const Handle(StepData_StepModel)& theModel,
const StepData_Factors& theLocalFactors);
//! Returns True if Init was called successfully

View File

@@ -346,9 +346,11 @@ Standard_Boolean STEPConstruct_ValidationProps::AddProp (const StepRepr_Characte
// record SDR in order to have it written to the file
Model()->AddWithRefs ( PrDR );
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(Model());
// for AP203, add subschema name
if ( Interface_Static::IVal("write.step.schema") ==3 ) {
APIHeaderSection_MakeHeader mkHdr ( Handle(StepData_StepModel)::DownCast ( Model() ) );
if ( aStepModel->InternalParameters.WriteSchema ==3 ) {
APIHeaderSection_MakeHeader mkHdr ( aStepModel );
Handle(TCollection_HAsciiString) subSchema =
new TCollection_HAsciiString ( "GEOMETRIC_VALIDATION_PROPERTIES_MIM" );
mkHdr.AddSchemaIdentifier ( subSchema );