mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Data Exchange - Update Readers with ShapeHealing parameters #247
All instances of using XSAlgo_AlgoContainer are replaced with XSAlgo_ShapeProcessor. Parameters for XSAlgo_ShapeProcessor operations are now can be passes via the updated interface of respective classes. Staqtic function to read processing parameters from file is added to XSAlgo_ShapeProcessor.
This commit is contained in:
committed by
Pasukhin Dmitry
parent
bb84ecf5c6
commit
f5a02d2b0c
@@ -119,7 +119,7 @@
|
||||
#include <TransferBRep_ShapeBinder.hxx>
|
||||
#include <UnitsMethods.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
#include <StepRepr_ConstructiveGeometryRepresentationRelationship.hxx>
|
||||
#include <StepRepr_ConstructiveGeometryRepresentation.hxx>
|
||||
#include <StepRepr_MechanicalDesignAndDraughtingRelationship.hxx>
|
||||
@@ -309,7 +309,7 @@ Handle(Transfer_Binder) STEPControl_ActorRead::Transfer
|
||||
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast ( TP->Model() );
|
||||
if (!aStepModel->IsInitializedUnit())
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer(); // update unit info
|
||||
aStepModel->SetLocalLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
|
||||
aLocalFactors.SetCascadeUnit(UnitsMethods::GetCasCadeLengthUnit());
|
||||
}
|
||||
@@ -809,7 +809,6 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
|
||||
return shbinder;
|
||||
isBound = Standard_False;
|
||||
Standard_Integer nb = sr->NbItems();
|
||||
// Used in XSAlgo::AlgoContainer()->ProcessShape (ssv; 13.11.2010)
|
||||
Standard_Integer nbTPitems = TP->NbMapped();
|
||||
Message_Messenger::StreamBuffer sout = TP->Messenger()->SendInfo();
|
||||
#ifdef TRANSLOG
|
||||
@@ -930,17 +929,19 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
|
||||
}
|
||||
|
||||
// [BEGIN] Proceed with non-manifold topology (ssv; 12.11.2010)
|
||||
if (!isManifold) {
|
||||
if (!isManifold)
|
||||
{
|
||||
Message_ProgressScope aPS1 (aPSRoot.Next(), "Process", 1);
|
||||
|
||||
Handle(Standard_Transient) info;
|
||||
// IMPORTANT: any fixing on non-manifold topology must be done after the shape is transferred from STEP
|
||||
TopoDS_Shape fixedResult =
|
||||
XSAlgo::AlgoContainer()->ProcessShape( comp, myPrecision, myMaxTol,
|
||||
"read.step.resource.name",
|
||||
"read.step.sequence", info,
|
||||
aPS1.Next(), Standard_True);
|
||||
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
|
||||
// Set tolerances for shape processing.
|
||||
// These parameters are calculated inside STEPControl_ActorRead::Transfer() and cannot be set from outside.
|
||||
Transfer_ActorOfTransientProcess::ParameterMap aParameters = GetParameters();
|
||||
XSAlgo_ShapeProcessor::SetParameter("FixShape.Tolerance3d", myPrecision, true, aParameters);
|
||||
XSAlgo_ShapeProcessor::SetParameter("FixShape.MaxTolerance3d", myMaxTol, true, aParameters);
|
||||
XSAlgo_ShapeProcessor::SetParameter("FixShape.NonManifold", std::to_string(true), true, aParameters);
|
||||
XSAlgo_ShapeProcessor aShapeProcessor(aParameters);
|
||||
TopoDS_Shape fixedResult = aShapeProcessor.ProcessShape(comp, GetProcessingFlags().first, aPS1.Next());
|
||||
aShapeProcessor.MergeTransferInfo(TP, nbTPitems);
|
||||
|
||||
if (fixedResult.ShapeType() == TopAbs_COMPOUND)
|
||||
{
|
||||
@@ -1554,15 +1555,16 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
|
||||
if (found && myShapeBuilder.IsDone()) {
|
||||
mappedShape = myShapeBuilder.Value();
|
||||
// Apply ShapeFix (on manifold shapes only. Non-manifold topology is processed separately: ssv; 13.11.2010)
|
||||
if (isManifold && aHasGeom)
|
||||
if (isManifold && aHasGeom)
|
||||
{
|
||||
Handle(Standard_Transient) info;
|
||||
mappedShape =
|
||||
XSAlgo::AlgoContainer()->ProcessShape( mappedShape, myPrecision, myMaxTol,
|
||||
"read.step.resource.name",
|
||||
"read.step.sequence", info,
|
||||
aPS.Next());
|
||||
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
|
||||
// Set tolerances for shape processing.
|
||||
// These parameters are calculated inside STEPControl_ActorRead::Transfer() and cannot be set from outside.
|
||||
Transfer_ActorOfTransientProcess::ParameterMap aParameters = GetParameters();
|
||||
XSAlgo_ShapeProcessor::SetParameter("FixShape.Tolerance3d", myPrecision, true, aParameters);
|
||||
XSAlgo_ShapeProcessor::SetParameter("FixShape.MaxTolerance3d", myMaxTol, true, aParameters);
|
||||
XSAlgo_ShapeProcessor aShapeProcessor(aParameters);
|
||||
mappedShape = aShapeProcessor.ProcessShape(mappedShape, GetProcessingFlags().first, aPS.Next());
|
||||
aShapeProcessor.MergeTransferInfo(TP, nbTPitems);
|
||||
}
|
||||
}
|
||||
found = !mappedShape.IsNull();
|
||||
@@ -1725,19 +1727,23 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
|
||||
// Apply ShapeFix
|
||||
Handle(Transfer_Binder) binder = TP->Find(fs);
|
||||
sb = Handle(TransferBRep_ShapeBinder)::DownCast(binder);
|
||||
if (!sb.IsNull() && !sb->Result().IsNull()) {
|
||||
if (!sb.IsNull() && !sb->Result().IsNull())
|
||||
{
|
||||
TopoDS_Shape S = sb->Result();
|
||||
|
||||
Handle(Standard_Transient) info;
|
||||
TopoDS_Shape shape = XSAlgo::AlgoContainer()->ProcessShape(S, myPrecision, myMaxTol,
|
||||
"read.step.resource.name",
|
||||
"read.step.sequence", info,
|
||||
theProgress);
|
||||
// TopoDS_Shape shape = XSAlgo::AlgoContainer()->PerformFixShape( S, TP, myPrecision, myMaxTol );
|
||||
if (shape != S)
|
||||
sb->SetResult(shape);
|
||||
Transfer_ActorOfTransientProcess::ParameterMap aParameters = GetParameters();
|
||||
XSAlgo_ShapeProcessor::SetParameter("FixShape.Tolerance3d", myPrecision, true, aParameters);
|
||||
XSAlgo_ShapeProcessor::SetParameter("FixShape.MaxTolerance3d", myMaxTol, true, aParameters);
|
||||
XSAlgo_ShapeProcessor aShapeProcessor(aParameters);
|
||||
TopoDS_Shape shape = aShapeProcessor.ProcessShape(S, GetProcessingFlags().first, theProgress);
|
||||
aShapeProcessor.MergeTransferInfo(TP, nbTPitems);
|
||||
|
||||
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
|
||||
if (shape != S)
|
||||
{
|
||||
sb->SetResult(shape);
|
||||
}
|
||||
|
||||
aShapeProcessor.MergeTransferInfo(TP, nbTPitems);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -64,7 +64,6 @@ class STEPControl_ActorRead : public Transfer_ActorOfTransientProcess
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
Standard_EXPORT STEPControl_ActorRead(const Handle(Interface_InterfaceModel)& theModel);
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE;
|
||||
@@ -116,13 +115,9 @@ public:
|
||||
const StepData_Factors& theLocalFactors = StepData_Factors());
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(STEPControl_ActorRead,Transfer_ActorOfTransientProcess)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
//! Transfers product definition entity
|
||||
//! theUseTrsf - special flag for using Axis2Placement from ShapeRepresentation for transform root shape
|
||||
Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity (
|
||||
@@ -204,11 +199,7 @@ protected:
|
||||
const Handle(Transfer_TransientProcess)& TP,
|
||||
const Message_ProgressRange& theProgress);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT TopoDS_Shell closeIDEASShell (const TopoDS_Shell& shell, const TopTools_ListOfShape& closingShells);
|
||||
|
||||
Standard_EXPORT void computeIDEASClosings (const TopoDS_Compound& comp, TopTools_IndexedDataMapOfShapeListOfShape& shellClosingMap);
|
||||
@@ -221,18 +212,12 @@ private:
|
||||
TopoDS_Compound& theCund,
|
||||
Message_ProgressScope& thePS);
|
||||
|
||||
private:
|
||||
StepToTopoDS_NMTool myNMTool;
|
||||
Standard_Real myPrecision;
|
||||
Standard_Real myMaxTol;
|
||||
Handle(StepRepr_Representation) mySRContext;
|
||||
Handle(Interface_InterfaceModel) myModel;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _STEPControl_ActorRead_HeaderFile
|
||||
|
@@ -94,7 +94,7 @@
|
||||
#include <TransferBRep_ShapeMapper.hxx>
|
||||
#include <UnitsMethods.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(STEPControl_ActorWrite,Transfer_ActorOfFinderProcess)
|
||||
|
||||
@@ -540,7 +540,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::Transfer (const Handle(Transfer_
|
||||
myContext.SetLevel ( 1 ); // set assembly level to 1 (to ensure)
|
||||
if (!model->IsInitializedUnit())
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer(); // update unit info
|
||||
model->SetLocalLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
|
||||
}
|
||||
Standard_Real aLFactor = model->WriteLengthUnit();
|
||||
@@ -634,33 +634,6 @@ Standard_Boolean STEPControl_ActorWrite::IsAssembly (const Handle(StepData_StepM
|
||||
return IsAssembly ( theModel, S );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TransferShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
/*
|
||||
static void UpdateMap (const TopoDS_Shape &shape,
|
||||
BRepTools_Modifier &M1,
|
||||
BRepTools_Modifier &M2,
|
||||
const Handle(Transfer_FinderProcess) &FinderProcess)
|
||||
{
|
||||
TopoDS_Shape S = M1.ModifiedShape ( shape );
|
||||
S = M2.ModifiedShape ( S );
|
||||
if ( S == shape ) return;
|
||||
|
||||
Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper ( FinderProcess, S );
|
||||
Handle(Transfer_Binder) binder = FinderProcess->Find ( mapper );
|
||||
if ( ! binder.IsNull() ) {
|
||||
mapper = TransferBRep::ShapeMapper ( FinderProcess, shape );
|
||||
FinderProcess->Bind ( mapper, binder );
|
||||
}
|
||||
|
||||
for ( TopoDS_Iterator it(shape); it.More(); it.Next() )
|
||||
UpdateMap ( it.Value(), M1, M2, FinderProcess );
|
||||
}
|
||||
*/
|
||||
|
||||
// PTV 16.09.2002 added for transferring vertices.
|
||||
static Standard_Boolean transferVertex (const Handle(Transfer_FinderProcess)& FP,
|
||||
Handle(StepShape_HArray1OfGeometricSetSelect)& aGSS,
|
||||
@@ -984,37 +957,32 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
|
||||
default : trmode =STEPControl_GeometricCurveSet; break;
|
||||
}
|
||||
}
|
||||
//:abv 24Jan99 CAX-IF TRJ3: expanded Shape Processing
|
||||
// TopoDS_Shape aShape = xShape;
|
||||
// eliminate conical surfaces with negative semiangles
|
||||
// Handle(TopoDSToStep_ConicalSurfModif) CSM = new TopoDSToStep_ConicalSurfModif();
|
||||
// BRepTools_Modifier CSMT(aShape,CSM);
|
||||
// if ( CSMT.IsDone() ) aShape = CSMT.ModifiedShape ( aShape );
|
||||
// // eliminate indirect elementary surfaces
|
||||
// Handle(TopoDSToStep_DirectModification) DM = new TopoDSToStep_DirectModification();
|
||||
// BRepTools_Modifier DMT(aShape,DM);
|
||||
// if ( DMT.IsDone() ) aShape = DMT.ModifiedShape ( aShape );
|
||||
//// aShape = TopoDSToStep::DirectFaces(xShape);
|
||||
|
||||
Message_ProgressScope aPS1(aPS.Next(), NULL, 2);
|
||||
|
||||
TopoDS_Shape aShape = xShape;
|
||||
Handle(Standard_Transient) info;
|
||||
|
||||
if (hasGeometry(aShape))
|
||||
Transfer_ActorOfFinderProcess::ParameterMap aParameters = GetParameters();
|
||||
XSAlgo_ShapeProcessor::SetParameter("FixShape.Tolerance3d", Tol, true, aParameters);
|
||||
XSAlgo_ShapeProcessor::SetParameter("FixShape.MaxTolerance3d",
|
||||
aStepModel->InternalParameters.ReadMaxPrecisionVal,
|
||||
true,
|
||||
aParameters);
|
||||
XSAlgo_ShapeProcessor aShapeProcessor(aParameters);
|
||||
|
||||
if (hasGeometry(aShape))
|
||||
{
|
||||
Standard_Real maxTol = aStepModel->InternalParameters.ReadMaxPrecisionVal;
|
||||
aShape = aShapeProcessor.ProcessShape(xShape, GetShapeProcessFlags().first, aPS1.Next());
|
||||
|
||||
aShape = XSAlgo::AlgoContainer()->ProcessShape(xShape, Tol, maxTol,
|
||||
"write.step.resource.name",
|
||||
"write.step.sequence", info,
|
||||
aPS1.Next());
|
||||
if (aPS1.UserBreak())
|
||||
{
|
||||
return Handle(Transfer_Binder)();
|
||||
}
|
||||
}
|
||||
|
||||
if (!isManifold)
|
||||
{
|
||||
mergeInfoForNM(FP, info);
|
||||
mergeInfoForNM(FP, aShapeProcessor.GetContext());
|
||||
}
|
||||
|
||||
// create a STEP entity corresponding to shape
|
||||
@@ -1248,10 +1216,8 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
|
||||
subbind->AddResult(TransientResult(itemTess));
|
||||
}
|
||||
|
||||
//:abv 24Jan99 CAX-IF TRJ3: Update FinderProcess map to take into account shape processing
|
||||
// UpdateMap ( xShape, CSMT, DMT, FP );
|
||||
if (!info.IsNull())
|
||||
XSAlgo::AlgoContainer()->MergeTransferInfo(FP, info);
|
||||
// If shape is not processed, this function does nothing. Intentionally.
|
||||
aShapeProcessor.MergeTransferInfo(FP);
|
||||
}
|
||||
|
||||
// - Make Shape Representation
|
||||
|
@@ -43,8 +43,6 @@ class STEPControl_ActorWrite : public Transfer_ActorOfFinderProcess
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT STEPControl_ActorWrite();
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Transfer_Finder)& start) Standard_OVERRIDE;
|
||||
@@ -98,19 +96,9 @@ public:
|
||||
Standard_EXPORT virtual Standard_Boolean IsAssembly (const Handle(StepData_StepModel)& theModel,
|
||||
TopoDS_Shape& S) const;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(STEPControl_ActorWrite,Transfer_ActorOfFinderProcess)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Non-manifold shapes are stored in NMSSR group
|
||||
//! (NON_MANIFOLD_SURFACE_SHAPE_REPRESENTATION).
|
||||
//! Use this method to get the corresponding NMSSR (or
|
||||
@@ -128,8 +116,7 @@ private:
|
||||
Standard_Boolean separateShapeToSoloVertex(const TopoDS_Shape& theShape,
|
||||
TopTools_SequenceOfShape& theVertices);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
Standard_Integer mygroup;
|
||||
Standard_Real mytoler;
|
||||
STEPConstruct_ContextTool myContext;
|
||||
|
@@ -11,7 +11,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <DE_ShapeFixParameters.hxx>
|
||||
#include <IFSelect_WorkLibrary.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
@@ -60,6 +60,7 @@
|
||||
#include <TColStd_MapOfAsciiString.hxx>
|
||||
#include <TColStd_SequenceOfAsciiString.hxx>
|
||||
#include <Transfer_TransientProcess.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
#include <XSControl_TransferReader.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
|
||||
@@ -83,7 +84,7 @@ STEPControl_Reader::STEPControl_Reader
|
||||
{
|
||||
STEPControl_Controller::Init();
|
||||
SetWS (WS,scratch);
|
||||
SetNorm ("STEP");
|
||||
SetNorm("STEP");
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -651,6 +652,23 @@ inline static TCollection_AsciiString getSiName(const Handle(StepBasic_SiUnit)&
|
||||
return aName;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
DE_ShapeFixParameters STEPControl_Reader::GetDefaultParameters() const
|
||||
{
|
||||
return DESTEP_Parameters::GetDefaultReadingParamsSTEP();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
ShapeProcess::OperationsFlags STEPControl_Reader::GetDefaultShapeProcessFlags() const
|
||||
{
|
||||
ShapeProcess::OperationsFlags aFlags;
|
||||
aFlags.set(ShapeProcess::Operation::FixShape);
|
||||
return aFlags;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : findUnits
|
||||
//purpose :
|
||||
|
@@ -126,22 +126,20 @@ public:
|
||||
//! Performs only if a model is not NULL
|
||||
Standard_EXPORT Standard_Real SystemLengthUnit() const;
|
||||
|
||||
|
||||
protected:
|
||||
//! Returns default parameters for shape fixing.
|
||||
//! This method is used by the base class to get default parameters for shape fixing.
|
||||
//! @return default parameters for shape fixing.
|
||||
Standard_EXPORT virtual DE_ShapeFixParameters GetDefaultParameters() const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
//! Returns default flags for shape processing.
|
||||
//! @return Default flags for shape processing.
|
||||
Standard_EXPORT virtual ShapeProcess::OperationsFlags GetDefaultShapeProcessFlags() const Standard_OVERRIDE;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Returns units for length , angle and solidangle for shape representations
|
||||
Standard_EXPORT Standard_Boolean findUnits (const Handle(StepRepr_RepresentationContext)& theReprContext, TColStd_Array1OfAsciiString& theNameUnits, TColStd_Array1OfReal& theFactorUnits);
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <STEPControl_Writer.hxx>
|
||||
|
||||
#include <DE_ShapeFixParameters.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <STEPControl_ActorWrite.hxx>
|
||||
@@ -24,7 +25,7 @@
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
#include <UnitsMethods.hxx>
|
||||
|
||||
@@ -49,7 +50,7 @@ STEPControl_Writer::STEPControl_Writer
|
||||
(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch)
|
||||
{
|
||||
STEPControl_Controller::Init();
|
||||
SetWS (WS,scratch);
|
||||
SetWS(WS, scratch);
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +158,7 @@ IFSelect_ReturnStatus STEPControl_Writer::Transfer
|
||||
thesession->TransferWriter()->SetTransferMode (mws);
|
||||
if (!Model()->IsInitializedUnit())
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer(); // update unit info
|
||||
Model()->SetLocalLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
|
||||
}
|
||||
if (!thesession->Model().IsNull())
|
||||
@@ -167,6 +168,7 @@ IFSelect_ReturnStatus STEPControl_Writer::Transfer
|
||||
Handle(STEPControl_ActorWrite) ActWrite =
|
||||
Handle(STEPControl_ActorWrite)::DownCast(WS()->NormAdaptor()->ActorWrite());
|
||||
ActWrite->SetGroupMode(Handle(StepData_StepModel)::DownCast(thesession->Model())->InternalParameters.WriteAssembly);
|
||||
InitializeMissingParameters();
|
||||
return thesession->TransferWriteShape(sh, compgraph, theProgress);
|
||||
}
|
||||
|
||||
@@ -215,3 +217,97 @@ void STEPControl_Writer::PrintStatsTransfer
|
||||
{
|
||||
thesession->TransferWriter()->PrintStats (what,mode);
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
void STEPControl_Writer::SetParameters(const ParameterMap& theParameters)
|
||||
{
|
||||
if (Handle(Transfer_ActorOfFinderProcess) anActor = GetActor())
|
||||
{
|
||||
anActor->SetParameters(theParameters);
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPControl_Writer::SetParameters(ParameterMap&& theParameters)
|
||||
{
|
||||
if (Handle(Transfer_ActorOfFinderProcess) anActor = GetActor())
|
||||
{
|
||||
anActor->SetParameters(std::move(theParameters));
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPControl_Writer::SetParameters(const DE_ShapeFixParameters& theParameters,
|
||||
const ParameterMap& theAdditionalParameters)
|
||||
{
|
||||
if (Handle(Transfer_ActorOfFinderProcess) anActor = GetActor())
|
||||
{
|
||||
anActor->SetParameters(theParameters, theAdditionalParameters);
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
const STEPControl_Writer::ParameterMap& STEPControl_Writer::GetParameters() const
|
||||
{
|
||||
static const ParameterMap anEmptyMap;
|
||||
const Handle(Transfer_ActorOfFinderProcess) anActor = GetActor();
|
||||
return anActor.IsNull() ? anEmptyMap : anActor->GetParameters();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPControl_Writer::SetShapeProcessFlags(const ShapeProcess::OperationsFlags& theFlags)
|
||||
{
|
||||
if (Handle(Transfer_ActorOfFinderProcess) anActor = GetActor())
|
||||
{
|
||||
anActor->SetShapeProcessFlags(theFlags);
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
const STEPControl_Writer::ProcessingFlags& STEPControl_Writer::GetShapeProcessFlags() const
|
||||
{
|
||||
static const ProcessingFlags anEmptyFlags;
|
||||
const Handle(Transfer_ActorOfFinderProcess) anActor = GetActor();
|
||||
return anActor.IsNull() ? anEmptyFlags : anActor->GetShapeProcessFlags();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Handle(Transfer_ActorOfFinderProcess) STEPControl_Writer::GetActor() const
|
||||
{
|
||||
Handle(XSControl_WorkSession) aSession = WS();
|
||||
if (aSession.IsNull())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Handle(XSControl_Controller) aController = aSession->NormAdaptor();
|
||||
if (aController.IsNull())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return aController->ActorWrite();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPControl_Writer::InitializeMissingParameters()
|
||||
{
|
||||
if (GetParameters().empty())
|
||||
{
|
||||
SetParameters(DESTEP_Parameters::GetDefaultWritingParamsSTEP());
|
||||
}
|
||||
if (GetShapeProcessFlags().second == false)
|
||||
{
|
||||
ShapeProcess::OperationsFlags aFlags;
|
||||
aFlags.set(ShapeProcess::Operation::SplitCommonVertex);
|
||||
aFlags.set(ShapeProcess::Operation::DirectFaces);
|
||||
SetShapeProcessFlags(aFlags);
|
||||
}
|
||||
}
|
||||
|
@@ -17,10 +17,10 @@
|
||||
#ifndef _STEPControl_Writer_HeaderFile
|
||||
#define _STEPControl_Writer_HeaderFile
|
||||
|
||||
#include <ShapeProcess.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <IFSelect_ReturnStatus.hxx>
|
||||
#include <DESTEP_Parameters.hxx>
|
||||
@@ -28,10 +28,13 @@
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
struct DE_ShapeFixParameters;
|
||||
class XSControl_WorkSession;
|
||||
class StepData_StepModel;
|
||||
class TopoDS_Shape;
|
||||
|
||||
class Transfer_ActorOfFinderProcess;
|
||||
|
||||
//! This class creates and writes
|
||||
//! STEP files from Open CASCADE models. A STEP file can be
|
||||
@@ -41,9 +44,13 @@ class TopoDS_Shape;
|
||||
class STEPControl_Writer
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
using ParameterMap = std::unordered_map<std::string, std::string>;
|
||||
// Flags defining operations to be performed on shapes. Since there is no std::optional in C++11,
|
||||
// we use a pair. The first element is the flags, the second element is a boolean value that indicates
|
||||
// whether the flags were set.
|
||||
using ProcessingFlags = std::pair<ShapeProcess::OperationsFlags, bool>;
|
||||
|
||||
//! Creates a Writer from scratch
|
||||
Standard_EXPORT STEPControl_Writer();
|
||||
@@ -126,28 +133,49 @@ public:
|
||||
//! AND the list of entity numbers in the STEP model.
|
||||
Standard_EXPORT void PrintStatsTransfer (const Standard_Integer what, const Standard_Integer mode = 0) const;
|
||||
|
||||
//! Sets parameters for shape processing.
|
||||
//! @param theParameters the parameters for shape processing.
|
||||
Standard_EXPORT void SetParameters(const ParameterMap& theParameters);
|
||||
|
||||
//! Sets parameters for shape processing.
|
||||
//! Parameters are moved from the input map.
|
||||
//! @param theParameters the parameters for shape processing.
|
||||
Standard_EXPORT void SetParameters(ParameterMap&& theParameters);
|
||||
|
||||
//! Sets parameters for shape processing.
|
||||
//! Parameters from @p theParameters are copied to the internal map.
|
||||
//! Parameters from @p theAdditionalParameters are copied to the internal map
|
||||
//! if they are not present in @p theParameters.
|
||||
//! @param theParameters the parameters for shape processing.
|
||||
//! @param theAdditionalParameters the additional parameters for shape processing.
|
||||
Standard_EXPORT void SetParameters(const DE_ShapeFixParameters& theParameters,
|
||||
const ParameterMap& theAdditionalParameters = {});
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
//! Returns parameters for shape processing that was set by SetParameters() method.
|
||||
//! @return the parameters for shape processing. Empty map if no parameters were set.
|
||||
Standard_EXPORT const ParameterMap& GetParameters() const;
|
||||
|
||||
//! Sets flags defining operations to be performed on shapes.
|
||||
//! @param theFlags The flags defining operations to be performed on shapes.
|
||||
Standard_EXPORT void SetShapeProcessFlags(const ShapeProcess::OperationsFlags& theFlags);
|
||||
|
||||
//! Returns flags defining operations to be performed on shapes.
|
||||
//! @return Pair of values defining operations to be performed on shapes and a boolean value
|
||||
//! that indicates whether the flags were set.
|
||||
Standard_EXPORT const ProcessingFlags& GetShapeProcessFlags() const;
|
||||
|
||||
private:
|
||||
//! Returns the Actor for the Transfer of an Entity.
|
||||
//! This Actor is used by the Writer to perform the Transfer.
|
||||
//! @return the Actor for the Transfer of an Entity. May be nullptr.
|
||||
Handle(Transfer_ActorOfFinderProcess) GetActor() const;
|
||||
|
||||
//! If parameters haven't yet been provided, initializes them with default values
|
||||
//! provided by GetDefaultParameters() method.
|
||||
void InitializeMissingParameters();
|
||||
|
||||
|
||||
private:
|
||||
Handle(XSControl_WorkSession) thesession;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _STEPControl_Writer_HeaderFile
|
||||
|
Reference in New Issue
Block a user