mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
Duplicate cleaner is added to STEP writers.
This commit is contained in:
parent
709412d78a
commit
63915ac011
@ -194,6 +194,8 @@ bool DESTEP_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRe
|
|||||||
(STEPControl_StepModelType)theResource->IntegerVal("write.model.type",
|
(STEPControl_StepModelType)theResource->IntegerVal("write.model.type",
|
||||||
InternalParameters.WriteModelType,
|
InternalParameters.WriteModelType,
|
||||||
aScope);
|
aScope);
|
||||||
|
InternalParameters.CleanDuplicates =
|
||||||
|
theResource->BooleanVal("write.cleanduplicates", InternalParameters.CleanDuplicates, aScope);
|
||||||
|
|
||||||
return DE_ShapeFixConfigurationNode::Load(theResource);
|
return DE_ShapeFixConfigurationNode::Load(theResource);
|
||||||
}
|
}
|
||||||
@ -562,6 +564,13 @@ TCollection_AsciiString DESTEP_ConfigurationNode::Save() const
|
|||||||
aResult += aScope + "write.model.type :\t " + InternalParameters.WriteModelType + "\n";
|
aResult += aScope + "write.model.type :\t " + InternalParameters.WriteModelType + "\n";
|
||||||
aResult += "!\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 += DE_ShapeFixConfigurationNode::Save();
|
||||||
|
|
||||||
aResult += "!*****************************************************************************\n";
|
aResult += "!*****************************************************************************\n";
|
||||||
|
@ -200,6 +200,7 @@ public:
|
|||||||
bool WriteLayer = true; //<! LayerMode is used to indicate write Layers or not
|
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
|
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
|
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
|
// clang-format on
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -116,6 +116,7 @@ bool DESTEP_Provider::Write(const TCollection_AsciiString& thePath,
|
|||||||
aWriter.SetLayerMode(aNode->InternalParameters.WriteLayer);
|
aWriter.SetLayerMode(aNode->InternalParameters.WriteLayer);
|
||||||
aWriter.SetPropsMode(aNode->InternalParameters.WriteProps);
|
aWriter.SetPropsMode(aNode->InternalParameters.WriteProps);
|
||||||
aWriter.SetShapeFixParameters(aNode->ShapeFixParameters);
|
aWriter.SetShapeFixParameters(aNode->ShapeFixParameters);
|
||||||
|
aWriter.SetCleanDuplicates(aNode->InternalParameters.CleanDuplicates);
|
||||||
DESTEP_Parameters aParams = aNode->InternalParameters;
|
DESTEP_Parameters aParams = aNode->InternalParameters;
|
||||||
Standard_Real aScaleFactorMM = 1.;
|
Standard_Real aScaleFactorMM = 1.;
|
||||||
if (XCAFDoc_DocumentTool::GetLengthUnit(theDocument,
|
if (XCAFDoc_DocumentTool::GetLengthUnit(theDocument,
|
||||||
@ -274,6 +275,11 @@ bool DESTEP_Provider::Write(const TCollection_AsciiString& thePath,
|
|||||||
<< "\t: abandon, no model loaded";
|
<< "\t: abandon, no model loaded";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (aNode->InternalParameters.CleanDuplicates)
|
||||||
|
{
|
||||||
|
aWriter.CleanDuplicateEntities();
|
||||||
|
}
|
||||||
|
|
||||||
if (aWriter.Write(thePath.ToCString()) != IFSelect_RetDone)
|
if (aWriter.Write(thePath.ToCString()) != IFSelect_RetDone)
|
||||||
{
|
{
|
||||||
Message::SendFail() << "DESTEP_Provider: Error on writing file";
|
Message::SendFail() << "DESTEP_Provider: Error on writing file";
|
||||||
|
@ -292,6 +292,12 @@ void STEPCAFControl_Writer::Init(const Handle(XSControl_WorkSession)& theWS,
|
|||||||
|
|
||||||
IFSelect_ReturnStatus STEPCAFControl_Writer::Write(const Standard_CString theFileName)
|
IFSelect_ReturnStatus STEPCAFControl_Writer::Write(const Standard_CString theFileName)
|
||||||
{
|
{
|
||||||
|
if (myIsCleanDuplicates)
|
||||||
|
{
|
||||||
|
// remove duplicates
|
||||||
|
myWriter.CleanDuplicateEntities();
|
||||||
|
}
|
||||||
|
|
||||||
IFSelect_ReturnStatus aStatus = myWriter.Write(theFileName);
|
IFSelect_ReturnStatus aStatus = myWriter.Write(theFileName);
|
||||||
if (aStatus != IFSelect_RetDone)
|
if (aStatus != IFSelect_RetDone)
|
||||||
{
|
{
|
||||||
|
@ -226,6 +226,18 @@ public:
|
|||||||
|
|
||||||
Standard_Boolean GetMaterialMode() const { return myMatMode; }
|
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.
|
//! Sets parameters for shape processing.
|
||||||
//! @param theParameters the parameters for shape processing.
|
//! @param theParameters the parameters for shape processing.
|
||||||
Standard_EXPORT void SetShapeFixParameters(
|
Standard_EXPORT void SetShapeFixParameters(
|
||||||
@ -382,7 +394,8 @@ private:
|
|||||||
MoniTool_DataMapOfShapeTransient myMapCompMDGPR;
|
MoniTool_DataMapOfShapeTransient myMapCompMDGPR;
|
||||||
Standard_Boolean myGDTMode;
|
Standard_Boolean myGDTMode;
|
||||||
Standard_Boolean myMatMode;
|
Standard_Boolean myMatMode;
|
||||||
NCollection_Vector<Handle(StepRepr_RepresentationItem)> myGDTAnnotations;
|
Standard_Boolean myIsCleanDuplicates;
|
||||||
|
NCollection_Vector<Handle(StepRepr_RepresentationItem)> myGDTAnnotations;
|
||||||
Handle(StepVisual_DraughtingModel) myGDTPresentationDM;
|
Handle(StepVisual_DraughtingModel) myGDTPresentationDM;
|
||||||
Handle(StepVisual_HArray1OfPresentationStyleAssignment) myGDTPrsCurveStyle;
|
Handle(StepVisual_HArray1OfPresentationStyleAssignment) myGDTPrsCurveStyle;
|
||||||
Handle(StepRepr_ProductDefinitionShape) myGDTCommonPDS;
|
Handle(StepRepr_ProductDefinitionShape) myGDTCommonPDS;
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <StepData_StepModel.hxx>
|
#include <StepData_StepModel.hxx>
|
||||||
#include <StepData_Protocol.hxx>
|
#include <StepData_Protocol.hxx>
|
||||||
#include <StepData_StepWriter.hxx>
|
#include <StepData_StepWriter.hxx>
|
||||||
|
#include <StepTidy_DuplicateCleaner.hxx>
|
||||||
#include <TopExp_Explorer.hxx>
|
#include <TopExp_Explorer.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
#include <XSAlgo.hxx>
|
#include <XSAlgo.hxx>
|
||||||
@ -197,6 +198,14 @@ void STEPControl_Writer::PrintStatsTransfer(const Standard_Integer what,
|
|||||||
thesession->TransferWriter()->PrintStats(what, mode);
|
thesession->TransferWriter()->PrintStats(what, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================================
|
||||||
|
|
||||||
|
Standard_EXPORT void STEPControl_Writer::CleanDuplicateEntities()
|
||||||
|
{
|
||||||
|
StepTidy_DuplicateCleaner aCleaner(thesession);
|
||||||
|
aCleaner.Perform();
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
void STEPControl_Writer::SetShapeFixParameters(
|
void STEPControl_Writer::SetShapeFixParameters(
|
||||||
|
@ -131,6 +131,8 @@ public:
|
|||||||
Standard_EXPORT void PrintStatsTransfer(const Standard_Integer what,
|
Standard_EXPORT void PrintStatsTransfer(const Standard_Integer what,
|
||||||
const Standard_Integer mode = 0) const;
|
const Standard_Integer mode = 0) const;
|
||||||
|
|
||||||
|
Standard_EXPORT void CleanDuplicateEntities();
|
||||||
|
|
||||||
//! Sets parameters for shape processing.
|
//! Sets parameters for shape processing.
|
||||||
//! @param theParameters the parameters for shape processing.
|
//! @param theParameters the parameters for shape processing.
|
||||||
Standard_EXPORT void SetShapeFixParameters(
|
Standard_EXPORT void SetShapeFixParameters(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user