(STEPControl_StepModelType)theResource->IntegerVal("write.model.type",
InternalParameters.WriteModelType,
aScope);
+ InternalParameters.CleanDuplicates =
+ theResource->BooleanVal("write.cleanduplicates", InternalParameters.CleanDuplicates, aScope);
return DE_ShapeFixConfigurationNode::Load(theResource);
}
aResult += aScope + "write.model.type :\t " + InternalParameters.WriteModelType + "\n";
aResult += "!\n";
+ aResult += "!\n";
+ aResult += "!Setting up a flag that indicates whether or not duplicate entities should be "
+ "removed from the model befor writing.\n";
+ aResult += "!Default value: -. Available values: \"-\", \"+\"\n";
+ aResult += aScope + "write.cleanduplicates :\t " + InternalParameters.CleanDuplicates + "\n";
+ aResult += "!\n";
+
aResult += DE_ShapeFixConfigurationNode::Save();
aResult += "!*****************************************************************************\n";
bool WriteLayer = true; //<! LayerMode is used to indicate write Layers or not
bool WriteProps = true; //<! PropsMode is used to indicate write Validation properties or not
STEPControl_StepModelType WriteModelType = STEPControl_AsIs; //<! Gives you the choice of translation mode for an Open CASCADE shape that is being translated to STEP
+ bool CleanDuplicates = false; //<! Indicates whether to remove duplicate entities from the STEP file
// clang-format on
};
aWriter.SetLayerMode(aNode->InternalParameters.WriteLayer);
aWriter.SetPropsMode(aNode->InternalParameters.WriteProps);
aWriter.SetShapeFixParameters(aNode->ShapeFixParameters);
+ aWriter.SetCleanDuplicates(aNode->InternalParameters.CleanDuplicates);
DESTEP_Parameters aParams = aNode->InternalParameters;
Standard_Real aScaleFactorMM = 1.;
if (XCAFDoc_DocumentTool::GetLengthUnit(theDocument,
<< "\t: abandon, no model loaded";
return false;
}
+ if (aNode->InternalParameters.CleanDuplicates)
+ {
+ aWriter.CleanDuplicateEntities();
+ }
+
if (aWriter.Write(thePath.ToCString()) != IFSelect_RetDone)
{
Message::SendFail() << "DESTEP_Provider: Error on writing file";
IFSelect_ReturnStatus STEPCAFControl_Writer::Write(const Standard_CString theFileName)
{
+ if (myIsCleanDuplicates)
+ {
+ // remove duplicates
+ myWriter.CleanDuplicateEntities();
+ }
+
IFSelect_ReturnStatus aStatus = myWriter.Write(theFileName);
if (aStatus != IFSelect_RetDone)
{
Standard_Boolean GetMaterialMode() const { return myMatMode; }
+ //! Set clean duplicates flag.
+ //! If set to True, duplicates will be removed from the model.
+ //! @param theCleanDuplicates the flag to set.
+ void SetCleanDuplicates(const Standard_Boolean theCleanDuplicates)
+ {
+ myIsCleanDuplicates = theCleanDuplicates;
+ }
+
+ //! Returns the flag indicating whether duplicates should be removed from the model.
+ //! @return the flag indicating whether duplicates should be removed from the model.
+ Standard_Boolean GetCleanDuplicates() const { return myIsCleanDuplicates; }
+
//! Sets parameters for shape processing.
//! @param theParameters the parameters for shape processing.
Standard_EXPORT void SetShapeFixParameters(
MoniTool_DataMapOfShapeTransient myMapCompMDGPR;
Standard_Boolean myGDTMode;
Standard_Boolean myMatMode;
- NCollection_Vector<Handle(StepRepr_RepresentationItem)> myGDTAnnotations;
+ Standard_Boolean myIsCleanDuplicates;
+ NCollection_Vector<Handle(StepRepr_RepresentationItem)> myGDTAnnotations;
Handle(StepVisual_DraughtingModel) myGDTPresentationDM;
Handle(StepVisual_HArray1OfPresentationStyleAssignment) myGDTPrsCurveStyle;
Handle(StepRepr_ProductDefinitionShape) myGDTCommonPDS;
#include <StepData_StepModel.hxx>
#include <StepData_Protocol.hxx>
#include <StepData_StepWriter.hxx>
+#include <StepTidy_DuplicateCleaner.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Shape.hxx>
#include <XSAlgo.hxx>
thesession->TransferWriter()->PrintStats(what, mode);
}
+//=================================================================================================
+
+Standard_EXPORT void STEPControl_Writer::CleanDuplicateEntities()
+{
+ StepTidy_DuplicateCleaner aCleaner(thesession);
+ aCleaner.Perform();
+}
+
//=============================================================================
void STEPControl_Writer::SetShapeFixParameters(
Standard_EXPORT void PrintStatsTransfer(const Standard_Integer what,
const Standard_Integer mode = 0) const;
+ Standard_EXPORT void CleanDuplicateEntities();
+
//! Sets parameters for shape processing.
//! @param theParameters the parameters for shape processing.
Standard_EXPORT void SetShapeFixParameters(