Fixed issue with MakeHeader.
Fix isn't for review or integration. Only for the internal usage.
Need to adapt into work env.
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);
theResource->BooleanVal("write.props", InternalParameters.WriteProps, aScope);
InternalParameters.WriteModelType = (STEPControl_StepModelType)
theResource->IntegerVal("write.model.type", InternalParameters.WriteModelType, aScope);
+ InternalParameters.WriteNonmanifold =
+ theResource->IntegerVal("write.nonmanifold", InternalParameters.WriteNonmanifold, aScope);
return true;
}
aReader.SetLayerMode(aNode->InternalParameters.ReadLayer);
aReader.SetPropsMode(aNode->InternalParameters.ReadProps);
IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
- StepData_ConfParameters aParams;
- aReadStat = aReader.ReadFile(thePath.ToCString(), aParams);
+ aReadStat = aReader.ReadFile(thePath.ToCString(), aNode->InternalParameters);
if (aReadStat != IFSelect_RetDone)
{
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
thePath << "\t: abandon";
+ aNode->InternalParameters.Reset();
return false;
}
{
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
thePath << "\t: Cannot read any relevant data from the STEP file";
+ aNode->InternalParameters.Reset();
return false;
}
+ aNode->InternalParameters.Reset();
return true;
}
aWriter.SetNameMode(aNode->InternalParameters.WriteName);
aWriter.SetLayerMode(aNode->InternalParameters.WriteLayer);
aWriter.SetPropsMode(aNode->InternalParameters.WriteProps);
-
+ aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale(aNode->InternalParameters.WriteUnit, UnitsMethods_LengthUnit_Millimeter));
TDF_Label aLabel;
- StepData_ConfParameters aParams;
- if (!aWriter.Transfer(theDocument, aParams, aMode, 0, theProgress))
+ if (!aWriter.Transfer(theDocument, aNode->InternalParameters, aMode, 0, theProgress))
{
Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
thePath << "\t: The document cannot be translated or gives no result";
+ aNode->InternalParameters.Reset();
return false;
}
IFSelect_ReturnStatus aStatus = aWriter.Write(thePath.ToCString());
{
Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
thePath << "\t: No file written";
+ aNode->InternalParameters.Reset();
return false;;
}
case IFSelect_RetDone:
{
Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
thePath << "\t: Error on writing file";
+ aNode->InternalParameters.Reset();
return false;
}
}
+ aNode->InternalParameters.Reset();
return true;
}
STEPControl_Reader aReader;
aReader.SetWS(theWS);
IFSelect_ReturnStatus aReadstat = IFSelect_RetVoid;
- StepData_ConfParameters aParams;
- aReadstat = aReader.ReadFile(thePath.ToCString(), aParams);
+ aReadstat = aReader.ReadFile(thePath.ToCString(), aNode->InternalParameters);
Handle(StepData_StepModel) aModel = aReader.StepModel();
if (aReadstat != IFSelect_RetDone)
{
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
thePath << "\t: abandon, no model loaded";
+ aNode->InternalParameters.Reset();
return false;
}
aModel->SetLocalLengthUnit(aNode->GlobalParameters.LengthUnit);
{
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
thePath << "\t:Cannot read any relevant data from the STEP file";
+ aNode->InternalParameters.Reset();
return false;
}
theShape = aReader.OneShape();
+ aNode->InternalParameters.Reset();
return true;
}
IFSelect_ReturnStatus aWritestat = IFSelect_RetVoid;
Handle(StepData_StepModel) aModel = aWriter.Model();
aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale(aNode->InternalParameters.WriteUnit, UnitsMethods_LengthUnit_Millimeter));
- StepData_ConfParameters aParams;
- aWritestat = aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, aParams, true, theProgress);
+ aWritestat = aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, aNode->InternalParameters, true, theProgress);
if (aWritestat != IFSelect_RetDone)
{
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
thePath << "\t: abandon, no model loaded";
+ aNode->InternalParameters.Reset();
return false;
}
if (aWriter.Write(thePath.ToCString()) != IFSelect_RetDone)
{
Message::SendFail() << "STEPCAFControl_Provider: Error on writing file";
+ aNode->InternalParameters.Reset();
return false;
}
+ aNode->InternalParameters.Reset();
return true;
}
{
reader.ClearShapes();
Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(reader.Model());
+ myReader.WS()->TransferReader()->SetEncodeRegAngle(aModel->InternalParameters.EncodeRegAngle);
StepData_Factors aLocalFactors;
prepareUnits(aModel, doc, aLocalFactors);
Standard_Integer i;
#include <STEPControl_Writer.hxx>
+#include <APIHeaderSection_MakeHeader.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx>
#include <STEPControl_ActorWrite.hxx>
}
if (!thesession->Model().IsNull())
{
- Handle(StepData_StepModel)::DownCast(thesession->Model())->InternalParameters = theParams;
+ Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(thesession->Model());
+ aStepModel->InternalParameters = theParams;
+ thesession->TransferWriter()->SetNonmanifoldMode(aStepModel->InternalParameters.WriteNonmanifold);
+ aStepModel->ClearHeader();
+ APIHeaderSection_MakeHeader aHeaderApi;
+ aHeaderApi.Apply(aStepModel);
}
Handle(STEPControl_ActorWrite) ActWrite =
Handle(STEPControl_ActorWrite)::DownCast(WS()->NormAdaptor()->ActorWrite());
#include <HeaderSection_Protocol.hxx>
+#include <StepData_StepModel.hxx>
#include <StepShape_AdvancedBrepShapeRepresentation.hxx>
#include <StepShape_AdvancedFace.hxx>
// Removed from CC1-Rev2 to Rev4 : <StepVisual_AnnotationCurveOccurrence.hxx>
}
+//=======================================================================
+//function : SchemaName
+//purpose :
+//=======================================================================
+Standard_CString StepAP214_Protocol::SchemaName(const Handle(Interface_InterfaceModel)& theModel) const
+{
+ Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(theModel);
+ if (aModel.IsNull())
+ {
+ return "";
+ }
+ 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 :
//! 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)
return 0;
}
+Standard_CString StepData_Protocol::SchemaName() const
+{
+ return thename;
+}
-Standard_CString StepData_Protocol::SchemaName () const
+Standard_CString StepData_Protocol::SchemaName (const Handle(Interface_InterfaceModel)& theModel) const
{
+ (void)theModel;
return thename;
}
//! 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;
+
Standard_EXPORT virtual Standard_CString SchemaName() const;
//! Creates an empty Model for Step Norm
TopoDS_Shape sh = xu.BinderShape (mres->Binder());
// Ouh la vilaine verrue
- Standard_Real tolang = Interface_Static::RVal("read.encoderegularity.angle");
+ Standard_Real tolang = EncodeRegAngle();
if (tolang <= 0 || sh.IsNull()) return sh;
ShapeFix::EncodeRegularity (sh,tolang);
return sh;
//! Creates a TransferReader, empty
XSControl_TransferReader()
+ : myEncodeRegAngle(0.01)
{}
//! Sets a Controller. It is required to generate the Actor.
//! Returns actual value of file name
Standard_CString FileName() const
{ return myFileName.ToCString(); }
+
+ //! Sets value for EncodeRegularityAngle
+ void SetEncodeRegAngle(const Standard_Real theEncRegAngle)
+ { myEncodeRegAngle = theEncRegAngle; }
+
+ //! Returns value of EncodeRegularityAngle
+ Standard_Real EncodeRegAngle() const
+ { return myEncodeRegAngle; }
//! Clears data, according mode :
//! -1 all
Handle(Transfer_TransientProcess) myTP;
TColStd_DataMapOfIntegerTransient myResults;
Handle(TopTools_HSequenceOfShape) myShapeResult;
+ Standard_Real myEncodeRegAngle;
};
#endif // _XSControl_TransferReader_HeaderFile
if (theModel.IsNull()) return IFSelect_RetVoid;
TopoDS_Shape aShape = theShape;
- Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0;
+ Standard_Boolean isNMMode = NonmanifoldMode() != 0;
if (isNMMode)
{
ShapeUpgrade_RemoveLocations aRemLoc;
//! with an empty FinderProcess (but no controller, etc)
XSControl_TransferWriter()
: myTransferWriter(new Transfer_FinderProcess),
- myTransferMode(0)
+ myTransferMode(0),
+ myNonmanifoldMode(0)
{}
//! Returns the FinderProcess itself
void SetTransferMode (const Standard_Integer theMode)
{ myTransferMode = theMode; }
+ //! Returns Nonmanifold Mode
+ Standard_Integer NonmanifoldMode() const
+ { return myNonmanifoldMode; }
+
+ //! Changes Nonmanifold Mode
+ void SetNonmanifoldMode (const Standard_Integer theNonmMode)
+ { myNonmanifoldMode = theNonmMode; }
+
//! Prints statistics on current Trace File, according what,mode
//! See PrintStatsProcess for details
Standard_EXPORT void PrintStats (const Standard_Integer theWhat, const Standard_Integer theMode = 0) const;
Handle(XSControl_Controller) myController;
Handle(Transfer_FinderProcess) myTransferWriter;
Standard_Integer myTransferMode;
+ Standard_Integer myNonmanifoldMode;
};
#endif // _XSControl_TransferWriter_HeaderFile