mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-01 17:36:21 +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:
parent
a02c267a13
commit
e7031bbfab
@ -14,6 +14,7 @@
|
||||
#ifndef _DE_ShapeFixParameters_HeaderFile
|
||||
#define _DE_ShapeFixParameters_HeaderFile
|
||||
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
|
||||
//! Struct for shape healing parameters storage
|
||||
@ -30,7 +31,7 @@ struct DE_ShapeFixParameters
|
||||
double Tolerance3d = 1.e-6;
|
||||
double MaxTolerance3d = 1.0;
|
||||
double MinTolerance3d = 1.e-7;
|
||||
TopAbs_ShapeEnum DetalizationLevel = TopAbs_ShapeEnum::TopAbs_FACE;
|
||||
TopAbs_ShapeEnum DetalizationLevel = TopAbs_ShapeEnum::TopAbs_VERTEX;
|
||||
bool NonManifold = false;
|
||||
FixMode FixFreeShellMode = FixMode::FixOrNot;
|
||||
FixMode FixFreeFaceMode = FixMode::FixOrNot;
|
||||
|
@ -5,8 +5,8 @@ DE_ConfigurationNode.hxx
|
||||
DE_PluginHolder.hxx
|
||||
DE_Provider.cxx
|
||||
DE_Provider.hxx
|
||||
DE_ShapeFixConfigurationNode.cxx
|
||||
DE_ShapeFixConfigurationNode.hxx
|
||||
DE_ShapeFixParameters.hxx
|
||||
DE_ShapeFixParameters.cxx
|
||||
DE_Wrapper.cxx
|
||||
DE_Wrapper.hxx
|
||||
|
@ -55,19 +55,20 @@ bool DEIGES_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRe
|
||||
THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor();
|
||||
|
||||
InternalParameters.ReadBSplineContinuity =
|
||||
(ReadMode_BSplineContinuity)theResource->IntegerVal("read.iges.bspline.continuity",
|
||||
InternalParameters.ReadBSplineContinuity,
|
||||
aScope);
|
||||
(DEIGES_Parameters::ReadMode_BSplineContinuity)theResource->IntegerVal(
|
||||
"read.iges.bspline.continuity",
|
||||
InternalParameters.ReadBSplineContinuity,
|
||||
aScope);
|
||||
InternalParameters.ReadPrecisionMode =
|
||||
(ReadMode_Precision)theResource->IntegerVal("read.precision.mode",
|
||||
InternalParameters.ReadPrecisionMode,
|
||||
aScope);
|
||||
(DEIGES_Parameters::ReadMode_Precision)
|
||||
theResource->IntegerVal("read.precision.mode", InternalParameters.ReadPrecisionMode, aScope);
|
||||
InternalParameters.ReadPrecisionVal =
|
||||
theResource->RealVal("read.precision.val", InternalParameters.ReadPrecisionVal, aScope);
|
||||
InternalParameters.ReadMaxPrecisionMode =
|
||||
(ReadMode_MaxPrecision)theResource->IntegerVal("read.maxprecision.mode",
|
||||
InternalParameters.ReadMaxPrecisionMode,
|
||||
aScope);
|
||||
(DEIGES_Parameters::ReadMode_MaxPrecision)theResource->IntegerVal(
|
||||
"read.maxprecision.mode",
|
||||
InternalParameters.ReadMaxPrecisionMode,
|
||||
aScope);
|
||||
InternalParameters.ReadMaxPrecisionVal =
|
||||
theResource->RealVal("read.maxprecision.val", InternalParameters.ReadMaxPrecisionVal, aScope);
|
||||
InternalParameters.ReadSameParamMode =
|
||||
@ -75,9 +76,10 @@ bool DEIGES_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRe
|
||||
InternalParameters.ReadSameParamMode,
|
||||
aScope);
|
||||
InternalParameters.ReadSurfaceCurveMode =
|
||||
(ReadMode_SurfaceCurve)theResource->IntegerVal("read.surfacecurve.mode",
|
||||
InternalParameters.ReadSurfaceCurveMode,
|
||||
aScope);
|
||||
(DEIGES_Parameters::ReadMode_SurfaceCurve)theResource->IntegerVal(
|
||||
"read.surfacecurve.mode",
|
||||
InternalParameters.ReadSurfaceCurveMode,
|
||||
aScope);
|
||||
InternalParameters.EncodeRegAngle =
|
||||
theResource->RealVal("read.encoderegularity.angle", InternalParameters.EncodeRegAngle, aScope);
|
||||
|
||||
@ -99,13 +101,14 @@ bool DEIGES_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRe
|
||||
theResource->BooleanVal("read.layer", InternalParameters.ReadLayer, aScope);
|
||||
|
||||
InternalParameters.WriteBRepMode =
|
||||
(WriteMode_BRep)theResource->IntegerVal("write.brep.mode",
|
||||
InternalParameters.WriteBRepMode,
|
||||
aScope);
|
||||
(DEIGES_Parameters::WriteMode_BRep)theResource->IntegerVal("write.brep.mode",
|
||||
InternalParameters.WriteBRepMode,
|
||||
aScope);
|
||||
InternalParameters.WriteConvertSurfaceMode =
|
||||
(WriteMode_ConvertSurface)theResource->IntegerVal("write.convertsurface.mode",
|
||||
InternalParameters.WriteConvertSurfaceMode,
|
||||
aScope);
|
||||
(DEIGES_Parameters::WriteMode_ConvertSurface)theResource->IntegerVal(
|
||||
"write.convertsurface.mode",
|
||||
InternalParameters.WriteConvertSurfaceMode,
|
||||
aScope);
|
||||
InternalParameters.WriteHeaderAuthor =
|
||||
theResource->StringVal("write.header.author", InternalParameters.WriteHeaderAuthor, aScope);
|
||||
InternalParameters.WriteHeaderCompany =
|
||||
@ -119,15 +122,15 @@ bool DEIGES_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRe
|
||||
InternalParameters.WriteSequence =
|
||||
theResource->StringVal("write.sequence", InternalParameters.WriteSequence, aScope);
|
||||
InternalParameters.WritePrecisionMode =
|
||||
(WriteMode_PrecisionMode)theResource->IntegerVal("write.precision.mode",
|
||||
InternalParameters.WritePrecisionMode,
|
||||
aScope);
|
||||
(DEIGES_Parameters::WriteMode_PrecisionMode)theResource->IntegerVal(
|
||||
"write.precision.mode",
|
||||
InternalParameters.WritePrecisionMode,
|
||||
aScope);
|
||||
InternalParameters.WritePrecisionVal =
|
||||
theResource->RealVal("write.precision.val", InternalParameters.WritePrecisionVal, aScope);
|
||||
InternalParameters.WritePlaneMode =
|
||||
(WriteMode_PlaneMode)theResource->IntegerVal("write.plane.mode",
|
||||
InternalParameters.WritePlaneMode,
|
||||
aScope);
|
||||
(DEIGES_Parameters::WriteMode_PlaneMode)
|
||||
theResource->IntegerVal("write.plane.mode", InternalParameters.WritePlaneMode, aScope);
|
||||
InternalParameters.WriteOffsetMode =
|
||||
theResource->BooleanVal("write.offset", InternalParameters.WriteOffsetMode, aScope);
|
||||
InternalParameters.WriteColor =
|
||||
|
@ -14,6 +14,7 @@
|
||||
#ifndef _DEIGES_ConfigurationNode_HeaderFile
|
||||
#define _DEIGES_ConfigurationNode_HeaderFile
|
||||
|
||||
#include <DEIGES_Parameters.hxx>
|
||||
#include <DE_ConfigurationNode.hxx>
|
||||
#include <UnitsMethods_LengthUnit.hxx>
|
||||
|
||||
@ -84,101 +85,7 @@ public:
|
||||
Standard_OVERRIDE;
|
||||
|
||||
public:
|
||||
enum ReadMode_BSplineContinuity
|
||||
{
|
||||
ReadMode_BSplineContinuity_C0 = 0,
|
||||
ReadMode_BSplineContinuity_C1,
|
||||
ReadMode_BSplineContinuity_C2
|
||||
};
|
||||
|
||||
enum ReadMode_Precision
|
||||
{
|
||||
ReadMode_Precision_File = 0,
|
||||
ReadMode_Precision_User
|
||||
};
|
||||
|
||||
enum ReadMode_MaxPrecision
|
||||
{
|
||||
ReadMode_MaxPrecision_Preferred = 0,
|
||||
ReadMode_MaxPrecision_Forced
|
||||
};
|
||||
|
||||
enum ReadMode_SurfaceCurve
|
||||
{
|
||||
ReadMode_SurfaceCurve_Default = 0,
|
||||
ReadMode_SurfaceCurve_2DUse_Preferred = 2,
|
||||
ReadMode_SurfaceCurve_2DUse_Forced = -2,
|
||||
ReadMode_SurfaceCurve_3DUse_Preferred = 3,
|
||||
ReadMode_SurfaceCurve_3DUse_Forced = -3
|
||||
};
|
||||
|
||||
enum WriteMode_BRep
|
||||
{
|
||||
WriteMode_BRep_Faces = 0,
|
||||
WriteMode_BRep_BRep
|
||||
};
|
||||
|
||||
enum WriteMode_ConvertSurface
|
||||
{
|
||||
WriteMode_ConvertSurface_Off = 0,
|
||||
WriteMode_ConvertSurface_On
|
||||
};
|
||||
|
||||
enum WriteMode_PrecisionMode
|
||||
{
|
||||
WriteMode_PrecisionMode_Least = -1,
|
||||
WriteMode_PrecisionMode_Average = 0,
|
||||
WriteMode_PrecisionMode_Greatest = 1,
|
||||
WriteMode_PrecisionMode_Session = 2
|
||||
};
|
||||
|
||||
enum WriteMode_PlaneMode
|
||||
{
|
||||
WriteMode_PlaneMode_Plane = 0,
|
||||
WriteMode_PlaneMode_BSpline
|
||||
};
|
||||
|
||||
struct IGESCAFControl_InternalSection
|
||||
{
|
||||
// Common
|
||||
// clang-format off
|
||||
ReadMode_BSplineContinuity ReadBSplineContinuity = ReadMode_BSplineContinuity_C1; //<! Manages the continuity of BSpline curves
|
||||
ReadMode_Precision ReadPrecisionMode = ReadMode_Precision_File; //<! Reads the precision mode value
|
||||
double ReadPrecisionVal = 0.0001; //<! ReadMode_Precision for shape construction (if enabled user mode)
|
||||
ReadMode_MaxPrecision ReadMaxPrecisionMode = ReadMode_MaxPrecision_Preferred; //<! Defines the mode of applying the maximum allowed tolerance
|
||||
double ReadMaxPrecisionVal = 1; //<! Defines the maximum allowable tolerance
|
||||
bool ReadSameParamMode = false; //<! Defines the using of BRepLib::SameParameter
|
||||
ReadMode_SurfaceCurve ReadSurfaceCurveMode = ReadMode_SurfaceCurve_Default; //<! reference for the computation of curves in case of 2D/3D
|
||||
double EncodeRegAngle = 0.57295779513; //<! Continuity which these two faces are connected with at that edge
|
||||
|
||||
//Read
|
||||
bool ReadApproxd1 = false; //<! Flag to split bspline curves of degree 1
|
||||
TCollection_AsciiString ReadResourceName = "IGES"; //<! Defines the name of the resource file to read
|
||||
TCollection_AsciiString ReadSequence = "FromIGES"; //<! Defines the name of the sequence of operators to read
|
||||
bool ReadFaultyEntities = false; //<! Parameter for reading failed entities
|
||||
bool ReadOnlyVisible = false; //<! Parameter for reading invisible entities
|
||||
bool ReadColor = true; //<! ColorMode is used to indicate read Colors or not
|
||||
bool ReadName = true; //<! NameMode is used to indicate read Name or not
|
||||
bool ReadLayer = true; //<! LayerMode is used to indicate read Layers or not
|
||||
|
||||
// Write
|
||||
WriteMode_BRep WriteBRepMode = WriteMode_BRep_Faces; //<! Flag to define entities type to write
|
||||
WriteMode_ConvertSurface WriteConvertSurfaceMode = WriteMode_ConvertSurface_Off; //<! Flag to convert surface to elementary
|
||||
TCollection_AsciiString WriteHeaderAuthor; //<! Name of the author of the file
|
||||
TCollection_AsciiString WriteHeaderCompany; //<! Name of the sending company
|
||||
TCollection_AsciiString WriteHeaderProduct; //<! Name of the sending product
|
||||
TCollection_AsciiString WriteHeaderReciever; //<! Name of the receiving company
|
||||
TCollection_AsciiString WriteResourceName = "IGES"; //<! Defines the name of the resource file to write
|
||||
TCollection_AsciiString WriteSequence = "ToIGES"; //<! Defines the name of the sequence of operators to write
|
||||
WriteMode_PrecisionMode WritePrecisionMode = WriteMode_PrecisionMode_Average; //<! Specifies the mode of writing the resolution value into the IGES file
|
||||
double WritePrecisionVal = 0.0001; //<! Resolution value for an IGES file when WriteMode_PrecisionMode is Greatest
|
||||
WriteMode_PlaneMode WritePlaneMode = WriteMode_PlaneMode_Plane; //<! Flag to convert plane to the BSline
|
||||
// clang-format on
|
||||
bool WriteOffsetMode = false; //<! Writing offset curves like BSplines
|
||||
bool WriteColor = true; //<! ColorMode is used to indicate write Colors or not
|
||||
bool WriteName = true; //<! NameMode is used to indicate write Name or not
|
||||
bool WriteLayer = true; //<! LayerMode is used to indicate write Layers or not
|
||||
} InternalParameters;
|
||||
DEIGES_Parameters InternalParameters;
|
||||
};
|
||||
|
||||
#endif // _DEIGES_ConfigurationNode_HeaderFile
|
||||
|
92
src/DEIGES/DEIGES_Parameters.cxx
Normal file
92
src/DEIGES/DEIGES_Parameters.cxx
Normal file
@ -0,0 +1,92 @@
|
||||
// Copyright (c) 2023 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Interface_Static.hxx>
|
||||
|
||||
#include <DEIGES_Parameters.hxx>
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
void DEIGES_Parameters::InitFromStatic()
|
||||
{
|
||||
ReadBSplineContinuity = (ReadMode_BSplineContinuity)Interface_Static::IVal(
|
||||
"read.iges.bspline.continuity");
|
||||
ReadPrecisionMode =
|
||||
(ReadMode_Precision)Interface_Static::IVal("read.precision.mode");
|
||||
ReadPrecisionVal = Interface_Static::RVal("read.precision.val");
|
||||
ReadMaxPrecisionMode =
|
||||
(ReadMode_MaxPrecision)Interface_Static::IVal("read.maxprecision.mode");
|
||||
ReadMaxPrecisionVal = Interface_Static::RVal("read.maxprecision.val");
|
||||
ReadSameParamMode = Interface_Static::IVal("read.stdsameparameter.mode") == 1;
|
||||
ReadSurfaceCurveMode = (ReadMode_SurfaceCurve)Interface_Static::IVal("read.surfacecurve.mode");
|
||||
EncodeRegAngle = Interface_Static::RVal("read.encoderegularity.angle");
|
||||
|
||||
ReadApproxd1 = Interface_Static::IVal("read.bspline.approxd1.mode") == 1;
|
||||
ReadResourceName = Interface_Static::CVal("read.resource.name");
|
||||
ReadSequence = Interface_Static::CVal("read.sequence");
|
||||
ReadFaultyEntities = Interface_Static::IVal("read.fau_lty.entities") == 1;
|
||||
ReadOnlyVisible = Interface_Static::IVal("read.onlyvisible") == 1;
|
||||
ReadColor = Interface_Static::IVal("read.color") == 1;
|
||||
ReadName = Interface_Static::IVal("read.name") == 1;
|
||||
ReadLayer = Interface_Static::IVal("read.layer") == 1;
|
||||
|
||||
WriteBRepMode = (WriteMode_BRep)Interface_Static::IVal("write.brep.mode");
|
||||
WriteConvertSurfaceMode = (WriteMode_ConvertSurface)Interface_Static::IVal(
|
||||
"write.convertsurface.mode");
|
||||
WriteHeaderAuthor = Interface_Static::CVal("write.header.author");
|
||||
WriteHeaderCompany = Interface_Static::CVal("write.header.company");
|
||||
WriteHeaderProduct = Interface_Static::CVal("write.header.product");
|
||||
WriteHeaderReciever = Interface_Static::CVal("write.header.receiver");
|
||||
WriteResourceName = Interface_Static::CVal("write.resource.name");
|
||||
WriteSequence = Interface_Static::CVal("write.sequence");
|
||||
WritePrecisionMode =
|
||||
(WriteMode_PrecisionMode)Interface_Static::IVal("write.precision.mode");
|
||||
WritePrecisionVal = Interface_Static::RVal("write.precision.val");
|
||||
WritePlaneMode =
|
||||
(WriteMode_PlaneMode)Interface_Static::IVal("write.plane.mode");
|
||||
WriteOffsetMode = Interface_Static::IVal("write.offset") == 1;
|
||||
WriteColor = Interface_Static::IVal("write.color") == 1;
|
||||
WriteName = Interface_Static::IVal("write.name") == 1;
|
||||
WriteLayer = Interface_Static::IVal("write.layer") == 1;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
void DEIGES_Parameters::Reset()
|
||||
{
|
||||
*this = DEIGES_Parameters();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
DE_ShapeFixParameters DEIGES_Parameters::GetDefaultReadingParamsIGES()
|
||||
{
|
||||
DE_ShapeFixParameters aShapeFixParameters;
|
||||
aShapeFixParameters.DetalizationLevel = TopAbs_EDGE;
|
||||
aShapeFixParameters.CreateOpenSolidMode = DE_ShapeFixParameters::FixMode::Fix;
|
||||
aShapeFixParameters.FixTailMode = DE_ShapeFixParameters::FixMode::FixOrNot;
|
||||
aShapeFixParameters.MaxTailAngle = DE_ShapeFixParameters::FixMode::FixOrNot;
|
||||
return aShapeFixParameters;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
DE_ShapeFixParameters DEIGES_Parameters::GetDefaultWritingParamsIGES()
|
||||
{
|
||||
DE_ShapeFixParameters aShapeFixParameters;
|
||||
aShapeFixParameters.DetalizationLevel = TopAbs_EDGE;
|
||||
aShapeFixParameters.CreateOpenSolidMode = DE_ShapeFixParameters::FixMode::Fix;
|
||||
aShapeFixParameters.FixTailMode = DE_ShapeFixParameters::FixMode::FixOrNot;
|
||||
aShapeFixParameters.MaxTailAngle = DE_ShapeFixParameters::FixMode::FixOrNot;
|
||||
return aShapeFixParameters;
|
||||
}
|
136
src/DEIGES/DEIGES_Parameters.hxx
Normal file
136
src/DEIGES/DEIGES_Parameters.hxx
Normal file
@ -0,0 +1,136 @@
|
||||
// Copyright (c) 2023 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _DEIGES_Parameters_HeaderFile
|
||||
#define _DEIGES_Parameters_HeaderFile
|
||||
|
||||
#include <DE_ShapeFixParameters.hxx>
|
||||
#include <Resource_FormatType.hxx>
|
||||
#include <STEPControl_StepModelType.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <UnitsMethods_LengthUnit.hxx>
|
||||
|
||||
class DEIGES_Parameters
|
||||
{
|
||||
public:
|
||||
enum ReadMode_BSplineContinuity
|
||||
{
|
||||
ReadMode_BSplineContinuity_C0 = 0,
|
||||
ReadMode_BSplineContinuity_C1,
|
||||
ReadMode_BSplineContinuity_C2
|
||||
};
|
||||
|
||||
enum ReadMode_Precision
|
||||
{
|
||||
ReadMode_Precision_File = 0,
|
||||
ReadMode_Precision_User
|
||||
};
|
||||
|
||||
enum ReadMode_MaxPrecision
|
||||
{
|
||||
ReadMode_MaxPrecision_Preferred = 0,
|
||||
ReadMode_MaxPrecision_Forced
|
||||
};
|
||||
|
||||
enum ReadMode_SurfaceCurve
|
||||
{
|
||||
ReadMode_SurfaceCurve_Default = 0,
|
||||
ReadMode_SurfaceCurve_2DUse_Preferred = 2,
|
||||
ReadMode_SurfaceCurve_2DUse_Forced = -2,
|
||||
ReadMode_SurfaceCurve_3DUse_Preferred = 3,
|
||||
ReadMode_SurfaceCurve_3DUse_Forced = -3
|
||||
};
|
||||
|
||||
enum WriteMode_BRep
|
||||
{
|
||||
WriteMode_BRep_Faces = 0,
|
||||
WriteMode_BRep_BRep
|
||||
};
|
||||
|
||||
enum WriteMode_ConvertSurface
|
||||
{
|
||||
WriteMode_ConvertSurface_Off = 0,
|
||||
WriteMode_ConvertSurface_On
|
||||
};
|
||||
|
||||
enum WriteMode_PrecisionMode
|
||||
{
|
||||
WriteMode_PrecisionMode_Least = -1,
|
||||
WriteMode_PrecisionMode_Average = 0,
|
||||
WriteMode_PrecisionMode_Greatest = 1,
|
||||
WriteMode_PrecisionMode_Session = 2
|
||||
};
|
||||
|
||||
enum WriteMode_PlaneMode
|
||||
{
|
||||
WriteMode_PlaneMode_Plane = 0,
|
||||
WriteMode_PlaneMode_BSpline
|
||||
};
|
||||
|
||||
public:
|
||||
DEIGES_Parameters() = default;
|
||||
|
||||
//! Initialize parameters
|
||||
Standard_EXPORT void InitFromStatic();
|
||||
|
||||
//! Reset used parameters
|
||||
Standard_EXPORT void Reset();
|
||||
|
||||
//! Returns default parameters for reading STEP files.
|
||||
Standard_EXPORT static DE_ShapeFixParameters GetDefaultReadingParamsIGES();
|
||||
|
||||
//! Returns default parameters for writing STEP files.
|
||||
Standard_EXPORT static DE_ShapeFixParameters GetDefaultWritingParamsIGES();
|
||||
|
||||
public:
|
||||
// Common
|
||||
// clang-format off
|
||||
ReadMode_BSplineContinuity ReadBSplineContinuity = ReadMode_BSplineContinuity_C1; //<! Manages the continuity of BSpline curves
|
||||
ReadMode_Precision ReadPrecisionMode = ReadMode_Precision_File; //<! Reads the precision mode value
|
||||
double ReadPrecisionVal = 0.0001; //<! ReadMode_Precision for shape construction (if enabled user mode)
|
||||
ReadMode_MaxPrecision ReadMaxPrecisionMode = ReadMode_MaxPrecision_Preferred; //<! Defines the mode of applying the maximum allowed tolerance
|
||||
double ReadMaxPrecisionVal = 1; //<! Defines the maximum allowable tolerance
|
||||
bool ReadSameParamMode = false; //<! Defines the using of BRepLib::SameParameter
|
||||
ReadMode_SurfaceCurve ReadSurfaceCurveMode = ReadMode_SurfaceCurve_Default; //<! reference for the computation of curves in case of 2D/3D
|
||||
double EncodeRegAngle = 0.57295779513; //<! Continuity which these two faces are connected with at that edge
|
||||
|
||||
//Read
|
||||
bool ReadApproxd1 = false; //<! Flag to split bspline curves of degree 1
|
||||
TCollection_AsciiString ReadResourceName = "IGES"; //<! Defines the name of the resource file to read
|
||||
TCollection_AsciiString ReadSequence = "FromIGES"; //<! Defines the name of the sequence of operators to read
|
||||
bool ReadFaultyEntities = false; //<! Parameter for reading failed entities
|
||||
bool ReadOnlyVisible = false; //<! Parameter for reading invisible entities
|
||||
bool ReadColor = true; //<! ColorMode is used to indicate read Colors or not
|
||||
bool ReadName = true; //<! NameMode is used to indicate read Name or not
|
||||
bool ReadLayer = true; //<! LayerMode is used to indicate read Layers or not
|
||||
|
||||
// Write
|
||||
WriteMode_BRep WriteBRepMode = WriteMode_BRep_Faces; //<! Flag to define entities type to write
|
||||
WriteMode_ConvertSurface WriteConvertSurfaceMode = WriteMode_ConvertSurface_Off; //<! Flag to convert surface to elementary
|
||||
TCollection_AsciiString WriteHeaderAuthor; //<! Name of the author of the file
|
||||
TCollection_AsciiString WriteHeaderCompany; //<! Name of the sending company
|
||||
TCollection_AsciiString WriteHeaderProduct; //<! Name of the sending product
|
||||
TCollection_AsciiString WriteHeaderReciever; //<! Name of the receiving company
|
||||
TCollection_AsciiString WriteResourceName = "IGES"; //<! Defines the name of the resource file to write
|
||||
TCollection_AsciiString WriteSequence = "ToIGES"; //<! Defines the name of the sequence of operators to write
|
||||
WriteMode_PrecisionMode WritePrecisionMode = WriteMode_PrecisionMode_Average; //<! Specifies the mode of writing the resolution value into the IGES file
|
||||
double WritePrecisionVal = 0.0001; //<! Resolution value for an IGES file when WriteMode_PrecisionMode is Greatest
|
||||
WriteMode_PlaneMode WritePlaneMode = WriteMode_PlaneMode_Plane; //<! Flag to convert plane to the BSline
|
||||
bool WriteOffsetMode = false; //<! Writing offset curves like BSplines
|
||||
bool WriteColor = true; //<! ColorMode is used to indicate write Colors or not
|
||||
bool WriteName = true; //<! NameMode is used to indicate write Name or not
|
||||
bool WriteLayer = true; //<! LayerMode is used to indicate write Layers or not
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
#endif // _DESTEP_Parameters_HeaderFile
|
@ -66,19 +66,17 @@ void DEIGES_Provider::initStatic(const Handle(DE_ConfigurationNode)& theNode)
|
||||
|
||||
// Get previous values
|
||||
myOldValues.ReadBSplineContinuity =
|
||||
(DEIGES_ConfigurationNode::ReadMode_BSplineContinuity)Interface_Static::IVal(
|
||||
(DEIGES_Parameters::ReadMode_BSplineContinuity)Interface_Static::IVal(
|
||||
"read.iges.bspline.continuity");
|
||||
myOldValues.ReadPrecisionMode =
|
||||
(DEIGES_ConfigurationNode::ReadMode_Precision)Interface_Static::IVal("read.precision.mode");
|
||||
(DEIGES_Parameters::ReadMode_Precision)Interface_Static::IVal("read.precision.mode");
|
||||
myOldValues.ReadPrecisionVal = Interface_Static::RVal("read.precision.val");
|
||||
myOldValues.ReadMaxPrecisionMode =
|
||||
(DEIGES_ConfigurationNode::ReadMode_MaxPrecision)Interface_Static::IVal(
|
||||
"read.maxprecision.mode");
|
||||
(DEIGES_Parameters::ReadMode_MaxPrecision)Interface_Static::IVal("read.maxprecision.mode");
|
||||
myOldValues.ReadMaxPrecisionVal = Interface_Static::RVal("read.maxprecision.val");
|
||||
myOldValues.ReadSameParamMode = Interface_Static::IVal("read.stdsameparameter.mode") == 1;
|
||||
myOldValues.ReadSurfaceCurveMode =
|
||||
(DEIGES_ConfigurationNode::ReadMode_SurfaceCurve)Interface_Static::IVal(
|
||||
"read.surfacecurve.mode");
|
||||
(DEIGES_Parameters::ReadMode_SurfaceCurve)Interface_Static::IVal("read.surfacecurve.mode");
|
||||
myOldValues.EncodeRegAngle = Interface_Static::RVal("read.encoderegularity.angle") * 180.0 / M_PI;
|
||||
|
||||
myOldValues.ReadApproxd1 = Interface_Static::IVal("read.iges.bspline.approxd1.mode") == 1;
|
||||
@ -88,9 +86,9 @@ void DEIGES_Provider::initStatic(const Handle(DE_ConfigurationNode)& theNode)
|
||||
myOldValues.ReadOnlyVisible = Interface_Static::IVal("read.iges.onlyvisible") == 1;
|
||||
|
||||
myOldValues.WriteBRepMode =
|
||||
(DEIGES_ConfigurationNode::WriteMode_BRep)Interface_Static::IVal("write.iges.brep.mode");
|
||||
(DEIGES_Parameters::WriteMode_BRep)Interface_Static::IVal("write.iges.brep.mode");
|
||||
myOldValues.WriteConvertSurfaceMode =
|
||||
(DEIGES_ConfigurationNode::WriteMode_ConvertSurface)Interface_Static::IVal(
|
||||
(DEIGES_Parameters::WriteMode_ConvertSurface)Interface_Static::IVal(
|
||||
"write.convertsurface.mode");
|
||||
myOldValues.WriteHeaderAuthor = Interface_Static::CVal("write.iges.header.author");
|
||||
myOldValues.WriteHeaderCompany = Interface_Static::CVal("write.iges.header.company");
|
||||
@ -99,11 +97,10 @@ void DEIGES_Provider::initStatic(const Handle(DE_ConfigurationNode)& theNode)
|
||||
myOldValues.WriteResourceName = Interface_Static::CVal("write.iges.resource.name");
|
||||
myOldValues.WriteSequence = Interface_Static::CVal("write.iges.sequence");
|
||||
myOldValues.WritePrecisionMode =
|
||||
(DEIGES_ConfigurationNode::WriteMode_PrecisionMode)Interface_Static::IVal(
|
||||
"write.precision.mode");
|
||||
(DEIGES_Parameters::WriteMode_PrecisionMode)Interface_Static::IVal("write.precision.mode");
|
||||
myOldValues.WritePrecisionVal = Interface_Static::RVal("write.precision.val");
|
||||
myOldValues.WritePlaneMode =
|
||||
(DEIGES_ConfigurationNode::WriteMode_PlaneMode)Interface_Static::IVal("write.iges.plane.mode");
|
||||
(DEIGES_Parameters::WriteMode_PlaneMode)Interface_Static::IVal("write.iges.plane.mode");
|
||||
myOldValues.WriteOffsetMode = Interface_Static::IVal("write.iges.offset.mode") == 1;
|
||||
|
||||
myOldLengthUnit = Interface_Static::IVal("xstep.cascade.unit");
|
||||
@ -120,8 +117,7 @@ void DEIGES_Provider::initStatic(const Handle(DE_ConfigurationNode)& theNode)
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
void DEIGES_Provider::setStatic(
|
||||
const DEIGES_ConfigurationNode::IGESCAFControl_InternalSection& theParameter)
|
||||
void DEIGES_Provider::setStatic(const DEIGES_Parameters& theParameter)
|
||||
{
|
||||
Interface_Static::SetIVal("read.iges.bspline.continuity", theParameter.ReadBSplineContinuity);
|
||||
Interface_Static::SetIVal("read.precision.mode", theParameter.ReadPrecisionMode);
|
||||
|
@ -148,13 +148,13 @@ private:
|
||||
void initStatic(const Handle(DE_ConfigurationNode)& theNode);
|
||||
|
||||
//! Initialize static variables
|
||||
void setStatic(const DEIGES_ConfigurationNode::IGESCAFControl_InternalSection& theParameter);
|
||||
void setStatic(const DEIGES_Parameters& theParameter);
|
||||
|
||||
//! Reset used interface static variables
|
||||
void resetStatic();
|
||||
|
||||
DEIGES_ConfigurationNode::IGESCAFControl_InternalSection myOldValues;
|
||||
int myOldLengthUnit = 1;
|
||||
DEIGES_Parameters myOldValues;
|
||||
int myOldLengthUnit = 1;
|
||||
};
|
||||
|
||||
#endif // _DEIGES_Provider_HeaderFile
|
||||
|
@ -1,4 +1,6 @@
|
||||
DEIGES_ConfigurationNode.cxx
|
||||
DEIGES_ConfigurationNode.hxx
|
||||
DEIGES_Parameters.cxx
|
||||
DEIGES_Parameters.hxx
|
||||
DEIGES_Provider.cxx
|
||||
DEIGES_Provider.hxx
|
||||
|
@ -95,3 +95,17 @@ void DESTEP_Parameters::Reset()
|
||||
DESTEP_Parameters aParameters;
|
||||
*this = aParameters;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
DE_ShapeFixParameters DESTEP_Parameters::GetDefaultReadingParamsSTEP()
|
||||
{
|
||||
return DE_ShapeFixParameters();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
DE_ShapeFixParameters DESTEP_Parameters::GetDefaultWritingParamsSTEP()
|
||||
{
|
||||
return DE_ShapeFixParameters();
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
#ifndef _DESTEP_Parameters_HeaderFile
|
||||
#define _DESTEP_Parameters_HeaderFile
|
||||
|
||||
#include <DE_ShapeFixParameters.hxx>
|
||||
#include <Resource_FormatType.hxx>
|
||||
#include <STEPControl_StepModelType.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
@ -120,6 +121,7 @@ public:
|
||||
WriteMode_VertexMode_SingleVertex
|
||||
};
|
||||
|
||||
public:
|
||||
Standard_EXPORT DESTEP_Parameters();
|
||||
|
||||
//! Initialize parameters
|
||||
@ -143,6 +145,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
//! Returns default parameters for reading STEP files.
|
||||
Standard_EXPORT static DE_ShapeFixParameters GetDefaultReadingParamsSTEP();
|
||||
|
||||
//! Returns default parameters for writing STEP files.
|
||||
Standard_EXPORT static DE_ShapeFixParameters GetDefaultWritingParamsSTEP();
|
||||
|
||||
public:
|
||||
// Common
|
||||
// clang-format off
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include <XCAFDoc_LayerTool.hxx>
|
||||
#include <XCAFDoc_ShapeTool.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
#include <XSControl_TransferReader.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
#include <UnitsMethods.hxx>
|
||||
@ -163,13 +163,12 @@ Standard_Boolean IGESCAFControl_Reader::Transfer (const Handle(TDocStd_Document)
|
||||
Standard_Real aScaleFactorMM = 1.;
|
||||
if (!XCAFDoc_DocumentTool::GetLengthUnit(doc, aScaleFactorMM, UnitsMethods_LengthUnit_Millimeter))
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer(); // update unit info
|
||||
aScaleFactorMM = UnitsMethods::GetCasCadeLengthUnit();
|
||||
// set length unit to the document
|
||||
XCAFDoc_DocumentTool::SetLengthUnit(doc, aScaleFactorMM, UnitsMethods_LengthUnit_Millimeter);
|
||||
}
|
||||
aModel->ChangeGlobalSection().SetCascadeUnit(aScaleFactorMM);
|
||||
|
||||
TransferRoots(theProgress); // replaces the above
|
||||
num = NbShapes();
|
||||
if ( num <=0 ) return Standard_False;
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include <XCAFPrs.hxx>
|
||||
#include <XCAFPrs_Style.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
#include <UnitsMethods.hxx>
|
||||
|
||||
@ -589,7 +589,7 @@ void IGESCAFControl_Writer::prepareUnit(const TDF_Label& theLabel)
|
||||
}
|
||||
else
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer(); // update unit info
|
||||
Model()->ChangeGlobalSection().SetCascadeUnit(UnitsMethods::GetCasCadeLengthUnit());
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <XCAFPrs_IndexedDataMapOfShapeStyle.hxx>
|
||||
#include <XCAFPrs_DataMapOfStyleTransient.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
|
||||
class XSControl_WorkSession;
|
||||
class TDocStd_Document;
|
||||
class TCollection_AsciiString;
|
||||
|
@ -29,11 +29,18 @@
|
||||
#include <Transfer_TransientMapper.hxx>
|
||||
#include <TransferBRep_ShapeMapper.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IGESControl_ActorWrite,Transfer_ActorOfFinderProcess)
|
||||
|
||||
IGESControl_ActorWrite::IGESControl_ActorWrite () { ModeTrans() = 0; }
|
||||
//=============================================================================
|
||||
|
||||
IGESControl_ActorWrite::IGESControl_ActorWrite()
|
||||
{
|
||||
ModeTrans() = 0;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Standard_Boolean IGESControl_ActorWrite::Recognize
|
||||
(const Handle(Transfer_Finder)& start)
|
||||
@ -50,12 +57,14 @@ Standard_Boolean IGESControl_ActorWrite::Recognize
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Handle(Transfer_Binder) IGESControl_ActorWrite::Transfer
|
||||
(const Handle(Transfer_Finder)& start,
|
||||
const Handle(Transfer_FinderProcess)& FP,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer();
|
||||
|
||||
DeclareAndCast(IGESData_IGESModel,modl,FP->Model());
|
||||
if (modl.IsNull()) return NullResult();
|
||||
@ -63,27 +72,23 @@ Handle(Transfer_Binder) IGESControl_ActorWrite::Transfer
|
||||
Handle(Standard_Transient) ent;
|
||||
|
||||
DeclareAndCast(TransferBRep_ShapeMapper,shmap,start);
|
||||
if (!shmap.IsNull()) {
|
||||
if (!shmap.IsNull())
|
||||
{
|
||||
TopoDS_Shape shape = shmap->Value();
|
||||
if (shape.IsNull()) return NullResult();
|
||||
// modified by NIZHNY-EAP Tue Aug 29 11:16:54 2000 ___BEGIN___
|
||||
Handle(Standard_Transient) info;
|
||||
Standard_Real Tol = Interface_Static::RVal("write.precision.val");
|
||||
Standard_Real maxTol = Interface_Static::RVal("read.maxprecision.val");
|
||||
shape = XSAlgo::AlgoContainer()->ProcessShape( shape, Tol, maxTol,
|
||||
"write.iges.resource.name",
|
||||
"write.iges.sequence", info,
|
||||
theProgress, false, TopAbs_EDGE);
|
||||
// modified by NIZHNY-EAP Tue Aug 29 11:17:01 2000 ___END___
|
||||
if (shape.IsNull())
|
||||
{
|
||||
return NullResult();
|
||||
}
|
||||
|
||||
XSAlgo_ShapeProcessor aShapeProcessor(GetParameters());
|
||||
shape = aShapeProcessor.ProcessShape(shape, GetShapeProcessFlags().first, theProgress);
|
||||
|
||||
BRepToIGES_BREntity BR0; BR0.SetModel(modl); BR0.SetTransferProcess(FP);
|
||||
BRepToIGESBRep_Entity BR1; BR1.SetModel(modl); BR1.SetTransferProcess(FP);
|
||||
|
||||
if (themodetrans == 0) ent = BR0.TransferShape(shape, theProgress);
|
||||
if (themodetrans == 1) ent = BR1.TransferShape(shape, theProgress);
|
||||
// modified by NIZHNY-EAP Tue Aug 29 11:37:18 2000 ___BEGIN___
|
||||
XSAlgo::AlgoContainer()->MergeTransferInfo(FP, info);
|
||||
// modified by NIZHNY-EAP Tue Aug 29 11:37:25 2000 ___END___
|
||||
aShapeProcessor.MergeTransferInfo(FP);
|
||||
if (!ent.IsNull()) return TransientResult(ent);
|
||||
}
|
||||
DeclareAndCast(Transfer_TransientMapper,gemap,start);
|
||||
|
@ -21,21 +21,18 @@
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Transfer_ActorOfFinderProcess.hxx>
|
||||
|
||||
class Transfer_Finder;
|
||||
class Transfer_Binder;
|
||||
class Transfer_FinderProcess;
|
||||
|
||||
|
||||
class IGESControl_ActorWrite;
|
||||
|
||||
DEFINE_STANDARD_HANDLE(IGESControl_ActorWrite, Transfer_ActorOfFinderProcess)
|
||||
|
||||
//! Actor to write Shape to IGES
|
||||
class IGESControl_ActorWrite : public Transfer_ActorOfFinderProcess
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT IGESControl_ActorWrite();
|
||||
|
||||
//! Recognizes a ShapeMapper
|
||||
@ -50,21 +47,7 @@ public:
|
||||
const Handle(Transfer_FinderProcess)& FP,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IGESControl_ActorWrite,Transfer_ActorOfFinderProcess)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -15,6 +15,8 @@
|
||||
//abv 10.04.99 S4136: eliminate using BRepAPI::Precision()
|
||||
|
||||
#include <BRepLib.hxx>
|
||||
#include <DEIGES_Parameters.hxx>
|
||||
#include <DE_ShapeFixParameters.hxx>
|
||||
#include <IFSelect_CheckCounter.hxx>
|
||||
#include <IFSelect_Functions.hxx>
|
||||
#include <IGESControl_Controller.hxx>
|
||||
@ -35,6 +37,7 @@
|
||||
#include <Transfer_Binder.hxx>
|
||||
#include <Transfer_IteratorOfProcessForTransient.hxx>
|
||||
#include <Transfer_TransientProcess.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
#include <XSControl_Controller.hxx>
|
||||
#include <XSControl_TransferReader.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
@ -83,8 +86,6 @@ Handle(IGESData_IGESModel) IGESControl_Reader::IGESModel () const
|
||||
return Handle(IGESData_IGESModel)::DownCast(Model());
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbRootsForTransfer
|
||||
//purpose :
|
||||
@ -314,3 +315,19 @@ void IGESControl_Reader::PrintTransferInfo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
DE_ShapeFixParameters IGESControl_Reader::GetDefaultParameters() const
|
||||
{
|
||||
return DEIGES_Parameters::GetDefaultReadingParamsIGES();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
ShapeProcess::OperationsFlags IGESControl_Reader::GetDefaultShapeProcessFlags() const
|
||||
{
|
||||
ShapeProcess::OperationsFlags aFlags;
|
||||
aFlags.set(ShapeProcess::Operation::FixShape);
|
||||
return aFlags;
|
||||
}
|
||||
|
@ -20,16 +20,13 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <XSControl_Reader.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <IFSelect_PrintFail.hxx>
|
||||
#include <IFSelect_PrintCount.hxx>
|
||||
class XSControl_WorkSession;
|
||||
|
||||
class IGESData_IGESModel;
|
||||
|
||||
|
||||
|
||||
//! Reads IGES files, checks them and translates their contents into Open CASCADE models.
|
||||
//! The IGES data can be that of a whole model or that of a specific list of entities in the model.
|
||||
//! As in XSControl_Reader, you specify the list using a selection.
|
||||
@ -68,9 +65,7 @@ class IGESData_IGESModel;
|
||||
class IGESControl_Reader : public XSControl_Reader
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Creates a Reader from scratch
|
||||
Standard_EXPORT IGESControl_Reader();
|
||||
@ -96,29 +91,19 @@ public:
|
||||
//! Prints Statistics and check list for Transfer
|
||||
Standard_EXPORT void PrintTransferInfo (const IFSelect_PrintFail failwarn, const IFSelect_PrintCount mode) const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
//! Returns 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:
|
||||
|
||||
|
||||
|
||||
Standard_Boolean theReadOnlyVisible;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <IGESControl_Reader.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IGESControl_Reader_HeaderFile
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <BndLib_AddSurface.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <BRepToIGESBRep_Entity.hxx>
|
||||
#include <DEIGES_Parameters.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <GeomToIGES_GeomCurve.hxx>
|
||||
@ -41,62 +42,69 @@
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <Transfer_FinderProcess.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
|
||||
#include <errno.h>
|
||||
IGESControl_Writer::IGESControl_Writer ()
|
||||
: myTP (new Transfer_FinderProcess(10000)) ,
|
||||
myIsComputed (Standard_False)
|
||||
|
||||
//=============================================================================
|
||||
|
||||
IGESControl_Writer::IGESControl_Writer()
|
||||
: myTP(new Transfer_FinderProcess(10000)),
|
||||
myIsComputed(Standard_False)
|
||||
{
|
||||
// faudrait aussi (?) prendre les parametres par defaut ... ?
|
||||
IGESControl_Controller::Init();
|
||||
myEditor.Init(IGESSelect_WorkLibrary::DefineProtocol());
|
||||
myEditor.SetUnitName(Interface_Static::CVal ("write.iges.unit"));
|
||||
myEditor.ApplyUnit();
|
||||
myWriteMode = Interface_Static::IVal ("write.iges.brep.mode");
|
||||
myModel = myEditor.Model();
|
||||
myEditor.SetUnitName(Interface_Static::CVal("write.iges.unit"));
|
||||
myEditor.ApplyUnit();
|
||||
myWriteMode = Interface_Static::IVal("write.iges.brep.mode");
|
||||
myModel = myEditor.Model();
|
||||
}
|
||||
|
||||
IGESControl_Writer::IGESControl_Writer
|
||||
(const Standard_CString unit, const Standard_Integer modecr)
|
||||
: myTP (new Transfer_FinderProcess(10000)) ,
|
||||
myWriteMode (modecr) , myIsComputed (Standard_False)
|
||||
//=============================================================================
|
||||
|
||||
IGESControl_Writer::IGESControl_Writer(const Standard_CString theUnit,
|
||||
const Standard_Integer theModecr)
|
||||
: myTP(new Transfer_FinderProcess(10000)),
|
||||
myWriteMode(theModecr),
|
||||
myIsComputed(Standard_False)
|
||||
{
|
||||
// faudrait aussi (?) prendre les parametres par defaut ... ?
|
||||
IGESControl_Controller::Init();
|
||||
myEditor.Init(IGESSelect_WorkLibrary::DefineProtocol());
|
||||
myEditor.SetUnitName(unit);
|
||||
myEditor.SetUnitName(theUnit);
|
||||
myEditor.ApplyUnit();
|
||||
myModel = myEditor.Model();
|
||||
}
|
||||
|
||||
IGESControl_Writer::IGESControl_Writer
|
||||
(const Handle(IGESData_IGESModel)& model, const Standard_Integer modecr)
|
||||
: myTP (new Transfer_FinderProcess(10000)) ,
|
||||
myModel (model) ,
|
||||
myEditor (model,IGESSelect_WorkLibrary::DefineProtocol()) ,
|
||||
myWriteMode (modecr) , myIsComputed (Standard_False) { }
|
||||
//=============================================================================
|
||||
|
||||
IGESControl_Writer::IGESControl_Writer(const Handle(IGESData_IGESModel)& theModel,
|
||||
const Standard_Integer theModecr)
|
||||
: myTP(new Transfer_FinderProcess(10000)),
|
||||
myModel(theModel),
|
||||
myEditor(theModel, IGESSelect_WorkLibrary::DefineProtocol()),
|
||||
myWriteMode(theModecr),
|
||||
myIsComputed(Standard_False)
|
||||
{}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Standard_Boolean IGESControl_Writer::AddShape (const TopoDS_Shape& theShape,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if (theShape.IsNull()) return Standard_False;
|
||||
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer();
|
||||
|
||||
InitializeMissingParameters();
|
||||
|
||||
Message_ProgressScope aPS(theProgress, NULL, 2);
|
||||
// modified by NIZHNY-EAP Tue Aug 29 11:16:54 2000 ___BEGIN___
|
||||
Handle(Standard_Transient) info;
|
||||
Standard_Real Tol = Interface_Static::RVal("write.precision.val");
|
||||
Standard_Real maxTol = Interface_Static::RVal("read.maxprecision.val");
|
||||
TopoDS_Shape Shape = XSAlgo::AlgoContainer()->ProcessShape( theShape, Tol, maxTol,
|
||||
"write.iges.resource.name",
|
||||
"write.iges.sequence", info,
|
||||
aPS.Next(), false, TopAbs_EDGE);
|
||||
|
||||
XSAlgo_ShapeProcessor aShapeProcessor(myShapeProcParams);
|
||||
TopoDS_Shape Shape = aShapeProcessor.ProcessShape(theShape, myShapeProcFlags.first, aPS.Next());
|
||||
|
||||
if (!aPS.More())
|
||||
return Standard_False;
|
||||
|
||||
// modified by NIZHNY-EAP Tue Aug 29 11:17:01 2000 ___END___
|
||||
BRepToIGES_BREntity B0; B0.SetTransferProcess(myTP); B0.SetModel(myModel);
|
||||
BRepToIGESBRep_Entity B1; B1.SetTransferProcess(myTP); B1.SetModel(myModel);
|
||||
Handle(IGESData_IGESEntity) ent = myWriteMode?
|
||||
@ -106,9 +114,7 @@ Standard_Boolean IGESControl_Writer::AddShape (const TopoDS_Shape& theShape,
|
||||
|
||||
if(ent.IsNull())
|
||||
return Standard_False;
|
||||
// modified by NIZHNY-EAP Tue Aug 29 11:37:18 2000 ___BEGIN___
|
||||
XSAlgo::AlgoContainer()->MergeTransferInfo(myTP, info);
|
||||
// modified by NIZHNY-EAP Tue Aug 29 11:37:25 2000 ___END___
|
||||
aShapeProcessor.MergeTransferInfo(myTP);
|
||||
|
||||
//22.10.98 gka BUC60080
|
||||
|
||||
@ -203,6 +209,8 @@ Standard_Boolean IGESControl_Writer::AddGeom (const Handle(Standard_Transient)&
|
||||
return AddEntity (ent);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Standard_Boolean IGESControl_Writer::AddEntity (const Handle(IGESData_IGESEntity)& ent)
|
||||
{
|
||||
if (ent.IsNull()) return Standard_False;
|
||||
@ -211,6 +219,8 @@ Standard_Boolean IGESControl_Writer::AddEntity (const Handle(IGESData_IGESEntity
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void IGESControl_Writer::ComputeModel ()
|
||||
{
|
||||
if (!myIsComputed) {
|
||||
@ -220,31 +230,26 @@ void IGESControl_Writer::ComputeModel ()
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Standard_Boolean IGESControl_Writer::Write
|
||||
(Standard_OStream& S, const Standard_Boolean fnes)
|
||||
{
|
||||
if (!S) return Standard_False;
|
||||
ComputeModel();
|
||||
Standard_Integer nbEnt = myModel->NbEntities();
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout<<" IGES Write : "<<nbEnt<<" ent.s"<< std::flush;
|
||||
#endif
|
||||
if(!nbEnt)
|
||||
return Standard_False;
|
||||
IGESData_IGESWriter IW (myModel);
|
||||
// ne pas oublier le mode fnes ... a transmettre a IW
|
||||
IW.SendModel (IGESSelect_WorkLibrary::DefineProtocol());
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout<<" ... ecriture ..."<<std::flush;
|
||||
#endif
|
||||
if (fnes) IW.WriteMode() = 10;
|
||||
Standard_Boolean status = IW.Print(S);
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout<<" ... fichier ecrit ..."<<std::endl;
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Standard_Boolean IGESControl_Writer::Write
|
||||
(const Standard_CString file, const Standard_Boolean fnes)
|
||||
{
|
||||
@ -254,9 +259,6 @@ Standard_Boolean IGESControl_Writer::Write
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout<<" Ecriture fichier ("<< (fnes ? "fnes" : "IGES") <<"): "<<file<<std::endl;
|
||||
#endif
|
||||
Standard_Boolean res = Write (*aStream,fnes);
|
||||
|
||||
errno = 0;
|
||||
@ -266,3 +268,56 @@ Standard_Boolean IGESControl_Writer::Write
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void IGESControl_Writer::SetParameters(const ParameterMap& theParameters)
|
||||
{
|
||||
myShapeProcParams = theParameters;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void IGESControl_Writer::SetParameters(ParameterMap&& theParameters)
|
||||
{
|
||||
myShapeProcParams = std::move(theParameters);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void IGESControl_Writer::SetParameters(const DE_ShapeFixParameters& theParameters, const ParameterMap& theAdditionalParameters)
|
||||
{
|
||||
myShapeProcParams.clear();
|
||||
XSAlgo_ShapeProcessor::FillParameterMap(theParameters, true, myShapeProcParams);
|
||||
for (const auto& aParam : theAdditionalParameters)
|
||||
{
|
||||
if (myShapeProcParams.find(aParam.first) == myShapeProcParams.end())
|
||||
{
|
||||
myShapeProcParams[aParam.first] = aParam.second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void IGESControl_Writer::SetShapeProcessFlags(const ShapeProcess::OperationsFlags& theFlags)
|
||||
{
|
||||
myShapeProcFlags.first = theFlags;
|
||||
myShapeProcFlags.second = true;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void IGESControl_Writer::InitializeMissingParameters()
|
||||
{
|
||||
if (GetParameters().empty())
|
||||
{
|
||||
SetParameters(DEIGES_Parameters::GetDefaultWritingParamsIGES());
|
||||
}
|
||||
|
||||
if (!myShapeProcFlags.second)
|
||||
{
|
||||
myShapeProcFlags.first.set(ShapeProcess::Operation::DirectFaces);
|
||||
myShapeProcFlags.second = true;
|
||||
}
|
||||
}
|
||||
|
@ -17,16 +17,19 @@
|
||||
#ifndef _IGESControl_Writer_HeaderFile
|
||||
#define _IGESControl_Writer_HeaderFile
|
||||
|
||||
#include <ShapeProcess.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <IGESData_BasicEditor.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
struct DE_ShapeFixParameters;
|
||||
class Transfer_FinderProcess;
|
||||
class IGESData_IGESModel;
|
||||
class TopoDS_Shape;
|
||||
@ -47,9 +50,15 @@ class IGESData_IGESEntity;
|
||||
class IGESControl_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>;
|
||||
|
||||
public:
|
||||
//! Creates a writer object with the
|
||||
//! default unit (millimeters) and write mode (Face).
|
||||
//! IGESControl_Writer (const Standard_CString unit,
|
||||
@ -58,19 +67,21 @@ public:
|
||||
|
||||
//! Creates a writer with given
|
||||
//! values for units and for write mode.
|
||||
//! unit may be any unit that is accepted by the IGES standard.
|
||||
//! theUnit may be any unit that is accepted by the IGES standard.
|
||||
//! By default, it is the millimeter.
|
||||
//! modecr defines the write mode and may be:
|
||||
//! theModecr defines the write mode and may be:
|
||||
//! - 0: Faces (default)
|
||||
//! - 1: BRep.
|
||||
Standard_EXPORT IGESControl_Writer(const Standard_CString unit, const Standard_Integer modecr = 0);
|
||||
Standard_EXPORT IGESControl_Writer(const Standard_CString theUnit,
|
||||
const Standard_Integer theModecr = 0);
|
||||
|
||||
//! Creates a writer object with the
|
||||
//! prepared IGES model model in write mode.
|
||||
//! modecr defines the write mode and may be:
|
||||
//! prepared IGES model theModel in write mode.
|
||||
//! theModecr defines the write mode and may be:
|
||||
//! - 0: Faces (default)
|
||||
//! - 1: BRep.
|
||||
Standard_EXPORT IGESControl_Writer(const Handle(IGESData_IGESModel)& model, const Standard_Integer modecr = 0);
|
||||
Standard_EXPORT IGESControl_Writer(const Handle(IGESData_IGESModel)& theModel,
|
||||
const Standard_Integer theModecr = 0);
|
||||
|
||||
//! Returns the IGES model to be written in output.
|
||||
const Handle(IGESData_IGESModel) & Model() const
|
||||
@ -114,13 +125,49 @@ public:
|
||||
//! if the processor could not create the file).
|
||||
Standard_EXPORT Standard_Boolean Write (const Standard_CString file, const Standard_Boolean fnes = Standard_False);
|
||||
|
||||
private:
|
||||
//! 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 = {});
|
||||
|
||||
//! Returns parameters for shape processing that was set by SetParameters() method.
|
||||
//! @return the parameters for shape processing. Empty map if no parameters were set.
|
||||
inline const ParameterMap& GetParameters() const { return myShapeProcParams; }
|
||||
|
||||
//! 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 The flags defining operations to be performed on shapes.
|
||||
inline const ShapeProcess::OperationsFlags& GetShapeProcessFlags() const { return myShapeProcFlags.first; }
|
||||
|
||||
private:
|
||||
//! If parameters haven't yet been provided, initializes them with default values
|
||||
//! provided by GetDefaultParameters() method.
|
||||
void InitializeMissingParameters();
|
||||
|
||||
private:
|
||||
Handle(Transfer_FinderProcess) myTP;
|
||||
Handle(IGESData_IGESModel) myModel;
|
||||
IGESData_BasicEditor myEditor;
|
||||
Standard_Integer myWriteMode;
|
||||
Standard_Boolean myIsComputed;
|
||||
Handle(IGESData_IGESModel) myModel;
|
||||
IGESData_BasicEditor myEditor;
|
||||
Standard_Integer myWriteMode;
|
||||
Standard_Boolean myIsComputed;
|
||||
ParameterMap myShapeProcParams; //!< Parameters for shape processing.
|
||||
ProcessingFlags myShapeProcFlags; //!< Flags defining operations to be performed on shapes.
|
||||
};
|
||||
|
||||
#endif // _IGESControl_Writer_HeaderFile
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <Quantity_Date.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
#include <UnitsMethods.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -116,7 +116,7 @@ void IGESData_GlobalSection::Init(const Handle(Interface_ParamSet)& params,
|
||||
//Message_Msg Msg48 ("XSTEP_48");
|
||||
//Message_Msg Msg49 ("XSTEP_49");
|
||||
//======================================
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer(); // update unit info
|
||||
theSeparator = ','; theEndMark = ';';
|
||||
theSendName.Nullify(); theFileName.Nullify(); theSystemId.Nullify();
|
||||
theInterfaceVersion.Nullify();
|
||||
|
@ -32,52 +32,83 @@
|
||||
#include <Transfer_TransientProcess.hxx>
|
||||
#include <TransferBRep_ShapeBinder.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IGESToBRep_Actor,Transfer_ActorOfTransientProcess)
|
||||
|
||||
//=======================================================================
|
||||
//function : IGESToBRep_Actor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IGESToBRep_Actor::IGESToBRep_Actor ()
|
||||
{ thecontinuity = 0; theeps = 0.0001; }
|
||||
namespace
|
||||
{
|
||||
//=======================================================================
|
||||
//function : EncodeRegul
|
||||
//purpose : INTERNAL to encode regularity on edges
|
||||
//=======================================================================
|
||||
static Standard_Boolean EncodeRegul(const TopoDS_Shape& theShape)
|
||||
{
|
||||
const Standard_Real aToleranceAngle = Interface_Static::RVal("read.encoderegularity.angle");
|
||||
if (theShape.IsNull())
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
if (aToleranceAngle <= 0.)
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
BRepLib::EncodeRegularity(theShape, aToleranceAngle);
|
||||
}
|
||||
catch (const Standard_Failure&)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TrimTolerances
|
||||
//purpose : Trims tolerances of the shape according to static parameters
|
||||
//=======================================================================
|
||||
static void TrimTolerances(const TopoDS_Shape& theShape, const Standard_Real theTolerance)
|
||||
{
|
||||
if (Interface_Static::IVal("read.maxprecision.mode") == 1)
|
||||
{
|
||||
ShapeFix_ShapeTolerance aSFST;
|
||||
aSFST.LimitTolerance(theShape, 0, Max(theTolerance, Interface_Static::RVal("read.maxprecision.val")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetModel
|
||||
//purpose :
|
||||
|
||||
IGESToBRep_Actor::IGESToBRep_Actor() : thecontinuity(0), theeps(0.0001)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
|
||||
void IGESToBRep_Actor::SetModel (const Handle(Interface_InterfaceModel)& model)
|
||||
{
|
||||
themodel = model;
|
||||
theeps = Handle(IGESData_IGESModel)::DownCast(themodel)->GlobalSection().Resolution();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : SetContinuity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IGESToBRep_Actor::SetContinuity (const Standard_Integer continuity)
|
||||
{
|
||||
thecontinuity = continuity;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : GetContinuity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IGESToBRep_Actor::GetContinuity () const
|
||||
{
|
||||
return thecontinuity;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Recognize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IGESToBRep_Actor::Recognize
|
||||
(const Handle(Standard_Transient)& start)
|
||||
{
|
||||
@ -97,44 +128,9 @@ Standard_Boolean IGESToBRep_Actor::Recognize
|
||||
// Cas restants : non reconnus
|
||||
return Standard_False;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : EncodeRegul
|
||||
//purpose : INTERNAL to encode regularity on edges
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Boolean EncodeRegul (const TopoDS_Shape& sh)
|
||||
{
|
||||
Standard_Real tolang = Interface_Static::RVal("read.encoderegularity.angle");
|
||||
if (sh.IsNull()) return Standard_True;
|
||||
if (tolang <= 0) return Standard_True;
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
BRepLib::EncodeRegularity (sh,tolang);
|
||||
}
|
||||
catch(Standard_Failure const&) {
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : TrimTolerances
|
||||
//purpose : Trims tolerances of the shape according to static parameters
|
||||
//
|
||||
//=======================================================================
|
||||
|
||||
static void TrimTolerances (const TopoDS_Shape& shape,
|
||||
const Standard_Real tol)
|
||||
{
|
||||
if( Interface_Static::IVal("read.maxprecision.mode")==1) {
|
||||
ShapeFix_ShapeTolerance SFST;
|
||||
SFST.LimitTolerance (shape, 0, Max(tol,Interface_Static::RVal ("read.maxprecision.val")));
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Transfer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Transfer_Binder) IGESToBRep_Actor::Transfer
|
||||
(const Handle(Standard_Transient)& start, const Handle(Transfer_TransientProcess)& TP,
|
||||
const Message_ProgressRange& theProgress)
|
||||
@ -148,7 +144,7 @@ Handle(Transfer_Binder) IGESToBRep_Actor::Transfer
|
||||
return NullResult();
|
||||
TopoDS_Shape shape;
|
||||
|
||||
// appeler le transfert seulement si type OK
|
||||
// Call the transfer only if type is OK.
|
||||
Standard_Integer typnum = ent->TypeNumber();
|
||||
Standard_Integer fornum = ent->FormNumber();
|
||||
Standard_Real eps;
|
||||
@ -160,7 +156,7 @@ Handle(Transfer_Binder) IGESToBRep_Actor::Transfer
|
||||
// Start progress scope (no need to check if progress exists -- it is safe)
|
||||
Message_ProgressScope aPS(theProgress, "Transfer stage", 2);
|
||||
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer();
|
||||
IGESToBRep_CurveAndSurface CAS;
|
||||
CAS.SetModel(mymodel);
|
||||
CAS.SetContinuity(thecontinuity);
|
||||
@ -179,7 +175,6 @@ Handle(Transfer_Binder) IGESToBRep_Actor::Transfer
|
||||
if (eps > 1.E-08) {
|
||||
CAS.SetEpsGeom(eps);
|
||||
theeps = eps*CAS.GetUnitFactor();
|
||||
// Interface_Static::SetRVal("lastpreci",theeps);
|
||||
}
|
||||
Standard_Integer nbTPitems = TP->NbMapped();
|
||||
{
|
||||
@ -191,15 +186,18 @@ Handle(Transfer_Binder) IGESToBRep_Actor::Transfer
|
||||
shape.Nullify();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// fixing shape
|
||||
Handle(Standard_Transient) info;
|
||||
shape = XSAlgo::AlgoContainer()->ProcessShape(shape, theeps, CAS.GetMaxTol(),
|
||||
"read.iges.resource.name",
|
||||
"read.iges.sequence",
|
||||
info, aPS.Next(),
|
||||
false, TopAbs_EDGE);
|
||||
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
|
||||
|
||||
// Set tolerances for shape processing.
|
||||
// These parameters are calculated inside IGESToBRep_Actor::Transfer() and cannot be set from outside.
|
||||
Transfer_ActorOfTransientProcess::ParameterMap aParameters = GetParameters();
|
||||
XSAlgo_ShapeProcessor::SetParameter("FixShape.Tolerance3d", theeps, true, aParameters);
|
||||
XSAlgo_ShapeProcessor::SetParameter("FixShape.MaxTolerance3d", CAS.GetMaxTol(), true, aParameters);
|
||||
|
||||
XSAlgo_ShapeProcessor aShapeProcessor(aParameters);
|
||||
shape = aShapeProcessor.ProcessShape(shape, GetProcessingFlags().first, aPS.Next());
|
||||
aShapeProcessor.MergeTransferInfo(TP, nbTPitems);
|
||||
}
|
||||
|
||||
ShapeExtend_Explorer SBE;
|
||||
@ -216,6 +214,9 @@ Handle(Transfer_Binder) IGESToBRep_Actor::Transfer
|
||||
return binder;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Standard_Real IGESToBRep_Actor::UsedTolerance () const
|
||||
{ return theeps; }
|
||||
Standard_Real IGESToBRep_Actor::UsedTolerance() const
|
||||
{
|
||||
return theeps;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <Transfer_ActorOfTransientProcess.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
struct DE_ShapeFixParameters;
|
||||
class Interface_InterfaceModel;
|
||||
class Standard_Transient;
|
||||
class Transfer_Binder;
|
||||
@ -39,10 +40,7 @@ DEFINE_STANDARD_HANDLE(IGESToBRep_Actor, Transfer_ActorOfTransientProcess)
|
||||
//! then returns the Binder which contains the Result
|
||||
class IGESToBRep_Actor : public Transfer_ActorOfTransientProcess
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT IGESToBRep_Actor();
|
||||
|
||||
Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model);
|
||||
@ -66,30 +64,12 @@ public:
|
||||
//! the file or from statics
|
||||
Standard_EXPORT Standard_Real UsedTolerance() const;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IGESToBRep_Actor,Transfer_ActorOfTransientProcess)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Handle(Interface_InterfaceModel) themodel;
|
||||
Standard_Integer thecontinuity;
|
||||
Standard_Real theeps;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IGESToBRep_Actor_HeaderFile
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepLib.hxx>
|
||||
#include <DEIGES_Parameters.hxx>
|
||||
#include <IGESAppli.hxx>
|
||||
#include <IGESAppli_Protocol.hxx>
|
||||
#include <IGESData_FileProtocol.hxx>
|
||||
@ -45,7 +46,7 @@
|
||||
#include <Transfer_TransientProcess.hxx>
|
||||
#include <TransferBRep.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
//#include <ShapeCustom.hxx>
|
||||
@ -58,29 +59,68 @@
|
||||
|
||||
static Handle(IGESData_FileProtocol) protocol;
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IGESToBRep_Reader
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IGESToBRep_Reader::IGESToBRep_Reader ()
|
||||
namespace
|
||||
{
|
||||
theDone = Standard_False;
|
||||
if (protocol.IsNull()) {
|
||||
IGESAppli::Init(); IGESSolid::Init();
|
||||
//=======================================================================
|
||||
//function : EncodeRegul
|
||||
//purpose : INTERNAL to encode regularity on edges
|
||||
//=======================================================================
|
||||
static Standard_Boolean EncodeRegul(const TopoDS_Shape& theShape)
|
||||
{
|
||||
const Standard_Real aToleranceAngle = Interface_Static::RVal("read.encoderegularity.angle");
|
||||
if (theShape.IsNull())
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
if (aToleranceAngle <= 0.)
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
BRepLib::EncodeRegularity(theShape, aToleranceAngle);
|
||||
}
|
||||
catch (const Standard_Failure&)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TrimTolerances
|
||||
//purpose : Trims tolerances of the shape according to static parameters
|
||||
//=======================================================================
|
||||
static void TrimTolerances(const TopoDS_Shape& theShape, const Standard_Real theTolerance)
|
||||
{
|
||||
if (Interface_Static::IVal("read.maxprecision.mode") == 1)
|
||||
{
|
||||
ShapeFix_ShapeTolerance SFST;
|
||||
SFST.LimitTolerance(theShape, 0, Max(theTolerance, Interface_Static::RVal("read.maxprecision.val")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
IGESToBRep_Reader::IGESToBRep_Reader()
|
||||
: theDone(Standard_False)
|
||||
{
|
||||
if (protocol.IsNull())
|
||||
{
|
||||
IGESAppli::Init();
|
||||
IGESSolid::Init();
|
||||
protocol = new IGESData_FileProtocol;
|
||||
protocol->Add(IGESAppli::Protocol());
|
||||
protocol->Add(IGESSolid::Protocol());
|
||||
}
|
||||
theActor = new IGESToBRep_Actor;
|
||||
theProc = new Transfer_TransientProcess;
|
||||
theProc = new Transfer_TransientProcess;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : LoadFile
|
||||
//purpose : loads a Model from a file
|
||||
//=======================================================================
|
||||
//=============================================================================
|
||||
|
||||
Standard_Integer IGESToBRep_Reader::LoadFile (const Standard_CString filename)
|
||||
{
|
||||
@ -187,12 +227,9 @@ Standard_Integer IGESToBRep_Reader::LoadFile (const Standard_CString filename)
|
||||
return StatusFile;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : SetModel
|
||||
//purpose : Specifies a Model to work on
|
||||
//=======================================================================
|
||||
void IGESToBRep_Reader::SetModel (const Handle(IGESData_IGESModel)& model)
|
||||
void IGESToBRep_Reader::SetModel (const Handle(IGESData_IGESModel)& model)
|
||||
{
|
||||
theModel = model;
|
||||
theDone = Standard_False;
|
||||
@ -203,55 +240,45 @@ Standard_Integer IGESToBRep_Reader::LoadFile (const Standard_CString filename)
|
||||
theProc->Clear();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : Model
|
||||
//purpose : returns the Model to be worked on
|
||||
//=======================================================================
|
||||
Handle(IGESData_IGESModel) IGESToBRep_Reader::Model () const
|
||||
{ return theModel; }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTransientProcess
|
||||
//purpose : Specifies a TransferProcess
|
||||
//=======================================================================
|
||||
void IGESToBRep_Reader::SetTransientProcess
|
||||
(const Handle(Transfer_TransientProcess)& TP)
|
||||
{ theProc = TP; }
|
||||
|
||||
//=======================================================================
|
||||
//function : TransientProcess
|
||||
//purpose : Returns the TransferProcess
|
||||
//=======================================================================
|
||||
Handle(Transfer_TransientProcess) IGESToBRep_Reader::TransientProcess () const
|
||||
{ return theProc; }
|
||||
|
||||
//=======================================================================
|
||||
//function : Actor
|
||||
//purpose : returns theActor
|
||||
//=======================================================================
|
||||
Handle(IGESToBRep_Actor) IGESToBRep_Reader::Actor () const
|
||||
{ return theActor; }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose : Clears the result and Done status
|
||||
//=======================================================================
|
||||
void IGESToBRep_Reader::Clear ()
|
||||
Handle(IGESData_IGESModel) IGESToBRep_Reader::Model() const
|
||||
{
|
||||
theDone = Standard_False;
|
||||
return theModel;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void IGESToBRep_Reader::SetTransientProcess(const Handle(Transfer_TransientProcess)& TP)
|
||||
{
|
||||
theProc = TP;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Handle(Transfer_TransientProcess) IGESToBRep_Reader::TransientProcess() const
|
||||
{
|
||||
return theProc;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Handle(IGESToBRep_Actor) IGESToBRep_Reader::Actor() const
|
||||
{
|
||||
return theActor;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void IGESToBRep_Reader::Clear()
|
||||
{
|
||||
theDone = Standard_False;
|
||||
theShapes.Clear();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : Check
|
||||
//purpose : Checks the Model
|
||||
//=======================================================================
|
||||
Standard_Boolean IGESToBRep_Reader::Check
|
||||
(const Standard_Boolean withprint) const
|
||||
Standard_Boolean IGESToBRep_Reader::Check(const Standard_Boolean withprint) const
|
||||
{
|
||||
Interface_CheckTool cht (theModel,protocol);
|
||||
Interface_CheckIterator chl = cht.CompleteCheckList();
|
||||
@ -265,96 +292,15 @@ Standard_Integer IGESToBRep_Reader::LoadFile (const Standard_CString filename)
|
||||
return chl.IsEmpty(Standard_True);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDone
|
||||
//purpose : returns True if the last transfert was a success
|
||||
//=======================================================================
|
||||
Standard_Boolean IGESToBRep_Reader::IsDone () const
|
||||
{ return theDone; }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : EncodeRegul
|
||||
//purpose : INTERNAL to encode regularity on edges
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Boolean EncodeRegul (const TopoDS_Shape& sh)
|
||||
Standard_Boolean IGESToBRep_Reader::IsDone() const
|
||||
{
|
||||
Standard_Real tolang = Interface_Static::RVal("read.encoderegularity.angle");
|
||||
if (sh.IsNull()) return Standard_True;
|
||||
if (tolang <= 0) return Standard_True;
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
BRepLib::EncodeRegularity (sh,tolang);
|
||||
}
|
||||
catch(Standard_Failure const&) {
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
return theDone;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UpdateMap
|
||||
//purpose : Updates the correspondence map (Transfer_TransientProcess),
|
||||
// setting as translation results, the shapes received after
|
||||
// modification by modifier (BRepTools_Modifier)
|
||||
//warning : BRepTools_Modifier raises exception when it cannot find input
|
||||
// shape in its internal list
|
||||
//=======================================================================
|
||||
//=============================================================================
|
||||
|
||||
// comment as unused PTV 18.09.2000
|
||||
// static void UpdateMap (const Handle(Transfer_TransientProcess)& map,
|
||||
// const BRepTools_Modifier& modifier)
|
||||
// {
|
||||
// Transfer_IteratorOfProcessForTransient iterator = map->CompleteResult(Standard_True);
|
||||
// for (iterator.Start(); iterator.More(); iterator.Next()) {
|
||||
// const Handle(Transfer_Binder) binder = iterator.Value();
|
||||
// try { //to avoid exception in BRepTools_Modifier
|
||||
// OCC_CATCH_SIGNALS
|
||||
// if (binder->IsKind (STANDARD_TYPE (TransferBRep_ShapeBinder))) {
|
||||
// DeclareAndCast(TransferBRep_ShapeBinder, shapebinder, binder);
|
||||
// if (shapebinder->HasResult()) {
|
||||
// TopoDS_Shape result = shapebinder->Result();
|
||||
// TopoDS_Shape modified = modifier.ModifiedShape (result);
|
||||
// if (shapebinder->Status() != Transfer_StatusUsed) //to avoid exception
|
||||
// shapebinder->SetResult (modified);
|
||||
// }
|
||||
// }
|
||||
// else if (binder->IsKind (STANDARD_TYPE (TransferBRep_ShapeListBinder))) {
|
||||
// DeclareAndCast(TransferBRep_ShapeListBinder, shapelistbinder, binder);
|
||||
// for (Standard_Integer i = 1; i <= shapelistbinder->NbShapes(); i++) {
|
||||
// TopoDS_Shape result = shapelistbinder->Shape (i);
|
||||
// TopoDS_Shape modified = modifier.ModifiedShape (result);
|
||||
// shapelistbinder->SetResult (i, modified);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// catch(Standard_Failure) {
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//=======================================================================
|
||||
//function : TrimTolerances
|
||||
//purpose : Trims tolerances of the shape according to static parameters
|
||||
//
|
||||
//=======================================================================
|
||||
|
||||
static void TrimTolerances (const TopoDS_Shape& shape,
|
||||
const Standard_Real tol)
|
||||
{
|
||||
if( Interface_Static::IVal("read.maxprecision.mode")==1) {
|
||||
ShapeFix_ShapeTolerance SFST;
|
||||
SFST.LimitTolerance (shape, 0, Max(tol,Interface_Static::RVal ("read.maxprecision.val")));
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TransferRoots
|
||||
//purpose : Transfers all Roots Entities
|
||||
//=======================================================================
|
||||
void IGESToBRep_Reader::TransferRoots (const Standard_Boolean onlyvisible,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
@ -463,11 +409,8 @@ void IGESToBRep_Reader::TransferRoots (const Standard_Boolean onlyvisible,
|
||||
TF->Send (msg2065, Message_Info);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : Transfer
|
||||
//purpose : Transfers an Entity given
|
||||
//=======================================================================
|
||||
Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
@ -494,7 +437,7 @@ Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num,
|
||||
|
||||
Message_ProgressScope aPS(theProgress, "OneEnt", 2);
|
||||
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer();
|
||||
IGESToBRep_CurveAndSurface CAS;
|
||||
CAS.SetModel(theModel);
|
||||
Standard_Real eps;
|
||||
@ -544,19 +487,24 @@ Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num,
|
||||
exceptionRaised = Standard_True;
|
||||
}
|
||||
}
|
||||
if (!exceptionRaised) {
|
||||
// fixing shape
|
||||
// shape = XSAlgo::AlgoContainer()->PerformFixShape ( shape, theProc, eps*CAS.GetUnitFactor(), CAS.GetMaxTol() );
|
||||
if (!exceptionRaised)
|
||||
{
|
||||
InitializeMissingParameters();
|
||||
|
||||
// Set tolerances for shape processing.
|
||||
// These parameters are calculated inside IGESToBRep_Reader::Transfer() and cannot be set from outside.
|
||||
XSAlgo_ShapeProcessor::SetParameter("FixShape.Tolerance3d", eps * CAS.GetUnitFactor(), true, myShapeProcParams);
|
||||
XSAlgo_ShapeProcessor::SetParameter("FixShape.MaxTolerance3d", CAS.GetMaxTol(), true, myShapeProcParams);
|
||||
|
||||
XSAlgo_ShapeProcessor aShapeProcessor(myShapeProcParams);
|
||||
shape = aShapeProcessor.ProcessShape(shape, myShapeProcFlags.first, aPS.Next());
|
||||
|
||||
Handle(Standard_Transient) info;
|
||||
shape = XSAlgo::AlgoContainer()->ProcessShape( shape, eps*CAS.GetUnitFactor(), CAS.GetMaxTol(),
|
||||
"read.iges.resource.name",
|
||||
"read.iges.sequence", info,
|
||||
aPS.Next(), false, TopAbs_EDGE);
|
||||
if (aPS.UserBreak())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
XSAlgo::AlgoContainer()->MergeTransferInfo(theProc, info, nbTPitems);
|
||||
aShapeProcessor.MergeTransferInfo(theProc, nbTPitems);
|
||||
|
||||
ShapeExtend_Explorer SBE;
|
||||
if (SBE.ShapeType (shape,Standard_True) != TopAbs_SHAPE) {
|
||||
@ -589,39 +537,32 @@ Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num,
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : UsedTolerance
|
||||
//purpose : Returns the used tolerance (input)
|
||||
//=======================================================================
|
||||
Standard_Real IGESToBRep_Reader::UsedTolerance () const
|
||||
{ return theActor->UsedTolerance(); }
|
||||
Standard_Real IGESToBRep_Reader::UsedTolerance() const
|
||||
{
|
||||
return theActor->UsedTolerance();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbShapes
|
||||
//purpose : Returns the count of produced Shapes
|
||||
//=======================================================================
|
||||
Standard_Integer IGESToBRep_Reader::NbShapes () const
|
||||
{ return theShapes.Length(); }
|
||||
//=============================================================================
|
||||
|
||||
Standard_Integer IGESToBRep_Reader::NbShapes() const
|
||||
{
|
||||
return theShapes.Length();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Shape
|
||||
//purpose : Returns a Shape given its rank
|
||||
//=======================================================================
|
||||
TopoDS_Shape IGESToBRep_Reader::Shape (const Standard_Integer num) const
|
||||
//=============================================================================
|
||||
|
||||
TopoDS_Shape IGESToBRep_Reader::Shape(const Standard_Integer num) const
|
||||
{
|
||||
TopoDS_Shape res;
|
||||
if (num > 0 && num <= theShapes.Length()) res = theShapes.Value(num);
|
||||
return res;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : OneShape
|
||||
//purpose : Returns a unique Shape
|
||||
//=======================================================================
|
||||
TopoDS_Shape IGESToBRep_Reader::OneShape () const
|
||||
TopoDS_Shape IGESToBRep_Reader::OneShape() const
|
||||
{
|
||||
TopoDS_Shape res;
|
||||
Standard_Integer nb = theShapes.Length();
|
||||
@ -635,3 +576,56 @@ Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num,
|
||||
return C;
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void IGESToBRep_Reader::SetParameters(const ParameterMap& theParameters)
|
||||
{
|
||||
myShapeProcParams = theParameters;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void IGESToBRep_Reader::SetParameters(ParameterMap&& theParameters)
|
||||
{
|
||||
myShapeProcParams = std::move(theParameters);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void IGESToBRep_Reader::SetParameters(const DE_ShapeFixParameters& theParameters, const ParameterMap& theAdditionalParameters)
|
||||
{
|
||||
myShapeProcParams.clear();
|
||||
XSAlgo_ShapeProcessor::FillParameterMap(theParameters, true, myShapeProcParams);
|
||||
for (const auto& aParam : theAdditionalParameters)
|
||||
{
|
||||
if (myShapeProcParams.find(aParam.first) == myShapeProcParams.end())
|
||||
{
|
||||
myShapeProcParams[aParam.first] = aParam.second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void IGESToBRep_Reader::SetShapeProcessFlags(const ShapeProcess::OperationsFlags& theFlags)
|
||||
{
|
||||
myShapeProcFlags.first = theFlags;
|
||||
myShapeProcFlags.second = true;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void IGESToBRep_Reader::InitializeMissingParameters()
|
||||
{
|
||||
if (GetParameters().empty())
|
||||
{
|
||||
SetParameters(DEIGES_Parameters::GetDefaultReadingParamsIGES());
|
||||
}
|
||||
|
||||
if (!myShapeProcFlags.second)
|
||||
{
|
||||
myShapeProcFlags.first.set(ShapeProcess::Operation::FixShape);
|
||||
myShapeProcFlags.second = true;
|
||||
}
|
||||
}
|
||||
|
@ -17,15 +17,18 @@
|
||||
#ifndef _IGESToBRep_Reader_HeaderFile
|
||||
#define _IGESToBRep_Reader_HeaderFile
|
||||
|
||||
#include <Message_ProgressRange.hxx>
|
||||
#include <ShapeProcess.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
struct DE_ShapeFixParameters;
|
||||
class IGESData_IGESModel;
|
||||
class IGESToBRep_Actor;
|
||||
class Transfer_TransientProcess;
|
||||
@ -36,10 +39,15 @@ class TopoDS_Shape;
|
||||
class IGESToBRep_Reader
|
||||
{
|
||||
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>;
|
||||
|
||||
public:
|
||||
//! Creates a Reader
|
||||
Standard_EXPORT IGESToBRep_Reader();
|
||||
|
||||
@ -108,32 +116,48 @@ public:
|
||||
//! - a compound containing the resulting shapes if there are several.
|
||||
Standard_EXPORT TopoDS_Shape OneShape() 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.
|
||||
inline const ParameterMap& GetParameters() const { return myShapeProcParams; }
|
||||
|
||||
//! 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 The flags defining operations to be performed on shapes.
|
||||
inline const ShapeProcess::OperationsFlags& GetShapeProcessFlags() const { return myShapeProcFlags.first; }
|
||||
|
||||
private:
|
||||
//! If parameters haven't yet been provided, initializes them with default values.
|
||||
void InitializeMissingParameters();
|
||||
|
||||
|
||||
|
||||
Handle(IGESData_IGESModel) theModel;
|
||||
Standard_Boolean theDone;
|
||||
TopTools_SequenceOfShape theShapes;
|
||||
Handle(IGESToBRep_Actor) theActor;
|
||||
private:
|
||||
Handle(IGESData_IGESModel) theModel;
|
||||
Standard_Boolean theDone;
|
||||
TopTools_SequenceOfShape theShapes;
|
||||
Handle(IGESToBRep_Actor) theActor;
|
||||
Handle(Transfer_TransientProcess) theProc;
|
||||
|
||||
|
||||
ParameterMap myShapeProcParams; //!< Parameters for shape processing.
|
||||
ProcessingFlags myShapeProcFlags; //!< Flags defining operations to be performed on shapes.
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IGESToBRep_Reader_HeaderFile
|
||||
|
@ -216,7 +216,7 @@
|
||||
#include <XCAFDimTolObjects_DatumObject.hxx>
|
||||
#include <XCAFView_Object.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
#include <XSControl_TransferReader.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
#include <StepAP242_DraughtingModelItemAssociation.hxx>
|
||||
@ -568,7 +568,7 @@ void STEPCAFControl_Reader::prepareUnits(const Handle(StepData_StepModel)& theMo
|
||||
Standard_Real aScaleFactorMM = 1.;
|
||||
if (!XCAFDoc_DocumentTool::GetLengthUnit(theDoc, aScaleFactorMM, UnitsMethods_LengthUnit_Millimeter))
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer(); // update unit info
|
||||
aScaleFactorMM = UnitsMethods::GetCasCadeLengthUnit();
|
||||
// Sets length unit to the document
|
||||
XCAFDoc_DocumentTool::SetLengthUnit(theDoc, aScaleFactorMM, UnitsMethods_LengthUnit_Millimeter);
|
||||
@ -2368,7 +2368,7 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
|
||||
// calculate units
|
||||
Handle(StepVisual_DraughtingModel) aDModel =
|
||||
Handle(StepVisual_DraughtingModel)::DownCast(aDMIA->UsedRepresentation());
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer();
|
||||
STEPControl_ActorRead anActor(aTP->Model());
|
||||
StepData_Factors aLocalFactors = theLocalFactors;
|
||||
anActor.PrepareUnits(aDModel, aTP, aLocalFactors);
|
||||
@ -2477,7 +2477,7 @@ void readConnectionPoints(const Handle(XSControl_TransferReader)& theTR,
|
||||
}
|
||||
if (!aSDR.IsNull())
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer();
|
||||
STEPControl_ActorRead anActor(theTR->Model());
|
||||
StepData_Factors aLocalFactors = theLocalFactors;
|
||||
anActor.PrepareUnits(aSDR, aTP, aLocalFactors);
|
||||
@ -2915,7 +2915,7 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
|
||||
{
|
||||
Handle(StepGeom_Axis2Placement3d) anAx
|
||||
= Handle(StepGeom_Axis2Placement3d)::DownCast(aSRWP->ItemsValue(j));
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer();
|
||||
STEPControl_ActorRead anActor(aTP->Model());
|
||||
StepData_Factors aLocalFactors = theLocalFactors;
|
||||
anActor.PrepareUnits(aSRWP, aTP, aLocalFactors);
|
||||
@ -4455,7 +4455,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess
|
||||
StepData_Factors aLocalFactors = theLocalFactors;
|
||||
if (!aDMIA.IsNull())
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer();
|
||||
STEPControl_ActorRead anActor(aModel);
|
||||
Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess();
|
||||
anActor.PrepareUnits(aDMIA->UsedRepresentation(), aTP, aLocalFactors);
|
||||
@ -4811,7 +4811,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSes
|
||||
StepData_Factors aLocalFactors = theLocalFactors;
|
||||
if (!aDModel.IsNull())
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer();
|
||||
STEPControl_ActorRead anActor(aTP->Model());
|
||||
anActor.PrepareUnits(aDModel, aTP, aLocalFactors);
|
||||
}
|
||||
@ -5368,6 +5368,49 @@ Standard_Boolean STEPCAFControl_Reader::GetViewMode() const
|
||||
return myViewMode;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPCAFControl_Reader::SetParameters(const ParameterMap& theParameters)
|
||||
{
|
||||
myReader.SetParameters(theParameters);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPCAFControl_Reader::SetParameters(ParameterMap&& theParameters)
|
||||
{
|
||||
myReader.SetParameters(std::move(theParameters));
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPCAFControl_Reader::SetParameters(const DE_ShapeFixParameters& theParameters,
|
||||
const ParameterMap& theAdditionalParameters)
|
||||
{
|
||||
myReader.SetParameters(theParameters, theAdditionalParameters);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
const STEPCAFControl_Reader::ParameterMap& STEPCAFControl_Reader::GetParameters() const
|
||||
{
|
||||
return myReader.GetParameters();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPCAFControl_Reader::SetShapeProcessFlags(const ShapeProcess::OperationsFlags& theFlags)
|
||||
{
|
||||
return myReader.SetShapeProcessFlags(theFlags);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
const STEPCAFControl_Reader::ProcessingFlags& STEPCAFControl_Reader::GetShapeProcessFlags() const
|
||||
{
|
||||
return myReader.GetShapeProcessFlags();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadMetadata
|
||||
//purpose :
|
||||
|
@ -59,10 +59,12 @@ class Transfer_Binder;
|
||||
class STEPCAFControl_Reader
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
using ParameterMap = XSControl_Reader::ParameterMap;
|
||||
using ProcessingFlags = XSControl_Reader::ProcessingFlags;
|
||||
|
||||
public:
|
||||
//! Creates a reader with an empty
|
||||
//! STEP model and sets ColorMode, LayerMode, NameMode and
|
||||
//! PropsMode to Standard_True.
|
||||
@ -209,9 +211,38 @@ public:
|
||||
|
||||
const XCAFDoc_DataMapOfShapeLabel& GetShapeLabelMap() const { return myMap; }
|
||||
|
||||
protected:
|
||||
//! 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 = {});
|
||||
|
||||
//! 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;
|
||||
|
||||
protected:
|
||||
//! Translates STEP file already loaded into the reader
|
||||
//! into the document
|
||||
//! If num==0, translates all roots, else only root number num
|
||||
@ -319,7 +350,6 @@ protected:
|
||||
Standard_EXPORT virtual TCollection_ExtendedString convertName (const TCollection_AsciiString& theName) const;
|
||||
|
||||
private:
|
||||
|
||||
//! Internal method. Import all Datum attributes and set them to XCAF object. Set connection of Datum to GeomTolerance (theGDTL).
|
||||
Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
|
||||
const TDF_Label theGDTL,
|
||||
@ -361,7 +391,6 @@ private:
|
||||
Handle(TDataStd_NamedData)& theAttr) const;
|
||||
|
||||
private:
|
||||
|
||||
STEPControl_Reader myReader;
|
||||
NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> myFiles;
|
||||
XCAFDoc_DataMapOfShapeLabel myMap;
|
||||
@ -375,7 +404,6 @@ private:
|
||||
Standard_Boolean myMatMode;
|
||||
Standard_Boolean myViewMode;
|
||||
NCollection_DataMap<Handle(Standard_Transient), TDF_Label> myGDTMap;
|
||||
|
||||
};
|
||||
|
||||
#endif // _STEPCAFControl_Reader_HeaderFile
|
||||
|
@ -212,7 +212,7 @@
|
||||
#include <XCAFPrs_IndexedDataMapOfShapeStyle.hxx>
|
||||
#include <XCAFPrs_Style.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
#include <XSControl_TransferWriter.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
#include <UnitsMethods.hxx>
|
||||
@ -361,7 +361,7 @@ void STEPCAFControl_Writer::prepareUnit(const TDF_Label& theLabel,
|
||||
}
|
||||
else
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer(); // update unit info
|
||||
theModel->SetLocalLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
|
||||
theLocalFactors.SetCascadeUnit(UnitsMethods::GetCasCadeLengthUnit());
|
||||
}
|
||||
@ -563,6 +563,49 @@ Standard_Boolean STEPCAFControl_Writer::ExternFile(const Standard_CString theNam
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPCAFControl_Writer::SetParameters(const ParameterMap& theParameters)
|
||||
{
|
||||
myWriter.SetParameters(theParameters);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPCAFControl_Writer::SetParameters(ParameterMap&& theParameters)
|
||||
{
|
||||
myWriter.SetParameters(std::move(theParameters));
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPCAFControl_Writer::SetParameters(const DE_ShapeFixParameters& theParameters,
|
||||
const ParameterMap& theAdditionalParameters)
|
||||
{
|
||||
myWriter.SetParameters(theParameters, theAdditionalParameters);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
const STEPCAFControl_Writer::ParameterMap& STEPCAFControl_Writer::GetParameters() const
|
||||
{
|
||||
return myWriter.GetParameters();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void STEPCAFControl_Writer::SetShapeProcessFlags(const ShapeProcess::OperationsFlags& theFlags)
|
||||
{
|
||||
myWriter.SetShapeProcessFlags(theFlags);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
const STEPCAFControl_Writer::ProcessingFlags& STEPCAFControl_Writer::GetShapeProcessFlags() const
|
||||
{
|
||||
return myWriter.GetShapeProcessFlags();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Transfer
|
||||
//purpose :
|
||||
|
@ -52,8 +52,10 @@ class STEPCAFControl_Writer
|
||||
public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
public:
|
||||
using ParameterMap = STEPControl_Writer::ParameterMap;
|
||||
using ProcessingFlags = STEPControl_Writer::ProcessingFlags;
|
||||
|
||||
public:
|
||||
//! Creates a writer with an empty
|
||||
//! STEP model and sets ColorMode, LayerMode, NameMode and
|
||||
//! PropsMode to Standard_True.
|
||||
@ -212,8 +214,38 @@ public:
|
||||
|
||||
Standard_Boolean GetMaterialMode() const { return myMatMode; }
|
||||
|
||||
protected:
|
||||
//! 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 = {});
|
||||
|
||||
//! 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;
|
||||
|
||||
protected:
|
||||
//! Transfers labels to a STEP model
|
||||
//! Returns True if translation is OK
|
||||
//! isExternFile setting from transferExternFiles method
|
||||
|
@ -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
|
||||
|
@ -218,6 +218,26 @@ Standard_Boolean ShapeProcess::Perform(const Handle(ShapeProcess_Context)& theCo
|
||||
return anIsAnySuccess;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
std::pair<ShapeProcess::Operation, bool> ShapeProcess::ToOperationFlag(const char* theName)
|
||||
{
|
||||
if (!theName)
|
||||
{
|
||||
return {Operation::First, false};
|
||||
}
|
||||
|
||||
for (std::underlying_type<Operation>::type anOperation = Operation::First; anOperation <= Operation::Last; ++anOperation)
|
||||
{
|
||||
const char* anOperationName = toOperationName(static_cast<Operation>(anOperation));
|
||||
if (anOperationName && !strcmp(theName, anOperationName))
|
||||
{
|
||||
return {static_cast<Operation>(anOperation), true};
|
||||
}
|
||||
}
|
||||
return {Operation::First, false};
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : getOperators
|
||||
//purpose :
|
||||
|
@ -99,6 +99,11 @@ public:
|
||||
const OperationsFlags& theOperations,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Converts operation name to operation flag.
|
||||
//! @param theName Operation name.
|
||||
//! @return Operation flag and true if the operation name is valid, false otherwise.
|
||||
Standard_EXPORT static std::pair<Operation, bool> ToOperationFlag(const char* theName);
|
||||
|
||||
private:
|
||||
//! Returns operators to be performed according to the specified flags.
|
||||
//! @param theFlags Bitset of operations flags.
|
||||
|
@ -74,7 +74,7 @@
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <Transfer_TransientProcess.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
|
||||
// ============================================================================
|
||||
// Method : RemoveSinglePCurve
|
||||
@ -164,7 +164,7 @@ static void CheckPCurves (TopoDS_Wire& aWire, const TopoDS_Face& aFace,
|
||||
|
||||
|
||||
// advanced check
|
||||
XSAlgo::AlgoContainer()->CheckPCurve (myEdge, aFace, preci, sbwd->IsSeam(i));
|
||||
XSAlgo_ShapeProcessor::CheckPCurve(myEdge, aFace, preci, sbwd->IsSeam(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,14 +20,21 @@
|
||||
#include <Transfer_ProcessForFinder.hxx>
|
||||
#include <Transfer_SimpleBinderOfTransient.hxx>
|
||||
#include <Transfer_TransientMapper.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Transfer_ActorOfFinderProcess,Transfer_ActorOfProcessForFinder)
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Transfer_ActorOfFinderProcess::Transfer_ActorOfFinderProcess () { themodetrans = 0; }
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Standard_Integer& Transfer_ActorOfFinderProcess::ModeTrans ()
|
||||
{ return themodetrans; }
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Handle(Transfer_Binder) Transfer_ActorOfFinderProcess::Transfer
|
||||
(const Handle(Transfer_Finder)& fnd,
|
||||
const Handle(Transfer_FinderProcess)& FP,
|
||||
@ -40,6 +47,8 @@ Handle(Transfer_Binder) Transfer_ActorOfFinderProcess::Transfer
|
||||
return TransientResult (res);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Handle(Transfer_Binder) Transfer_ActorOfFinderProcess::Transferring
|
||||
(const Handle(Transfer_Finder)& ent,
|
||||
const Handle(Transfer_ProcessForFinder)& TP,
|
||||
@ -48,6 +57,8 @@ Handle(Transfer_Binder) Transfer_ActorOfFinderProcess::Transferring
|
||||
return Transfer(ent,Handle(Transfer_FinderProcess)::DownCast(TP), theProgress);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Handle(Standard_Transient) Transfer_ActorOfFinderProcess::TransferTransient
|
||||
(const Handle(Standard_Transient)& /*ent*/,
|
||||
const Handle(Transfer_FinderProcess)&,
|
||||
@ -56,3 +67,41 @@ Handle(Standard_Transient) Transfer_ActorOfFinderProcess::TransferTransient
|
||||
Handle(Standard_Transient) nulres;
|
||||
return nulres;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void Transfer_ActorOfFinderProcess::SetParameters(const ParameterMap& theParameters)
|
||||
{
|
||||
myShapeProcParams = theParameters;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void Transfer_ActorOfFinderProcess::SetParameters(ParameterMap&& theParameters)
|
||||
{
|
||||
myShapeProcParams = std::move(theParameters);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void Transfer_ActorOfFinderProcess::SetParameters(const DE_ShapeFixParameters& theParameters,
|
||||
const ParameterMap& theAdditionalParameters)
|
||||
{
|
||||
myShapeProcParams.clear();
|
||||
XSAlgo_ShapeProcessor::FillParameterMap(theParameters, true, myShapeProcParams);
|
||||
for (const auto& aParam : theAdditionalParameters)
|
||||
{
|
||||
if (myShapeProcParams.find(aParam.first) == myShapeProcParams.end())
|
||||
{
|
||||
myShapeProcParams[aParam.first] = aParam.second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void Transfer_ActorOfFinderProcess::SetShapeProcessFlags(const ShapeProcess::OperationsFlags& theFlags)
|
||||
{
|
||||
myShapeProcFlags.first = theFlags;
|
||||
myShapeProcFlags.second = true;
|
||||
}
|
||||
|
@ -18,8 +18,12 @@
|
||||
#define _Transfer_ActorOfFinderProcess_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
|
||||
#include <ShapeProcess.hxx>
|
||||
#include <Transfer_ActorOfProcessForFinder.hxx>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
struct DE_ShapeFixParameters;
|
||||
class Transfer_Binder;
|
||||
class Transfer_Finder;
|
||||
class Transfer_ProcessForFinder;
|
||||
@ -36,10 +40,14 @@ DEFINE_STANDARD_HANDLE(Transfer_ActorOfFinderProcess, Transfer_ActorOfProcessFor
|
||||
//! a user. To be interpreted for each norm
|
||||
class Transfer_ActorOfFinderProcess : public Transfer_ActorOfProcessForFinder
|
||||
{
|
||||
public:
|
||||
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>;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT Transfer_ActorOfFinderProcess();
|
||||
|
||||
//! Returns the Transfer Mode, modifiable
|
||||
@ -60,22 +68,45 @@ public:
|
||||
const Handle(Transfer_FinderProcess)& TP,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! 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 = {});
|
||||
|
||||
//! Returns parameters for shape processing that was set by SetParameters() method.
|
||||
//! @return the parameters for shape processing. Empty map if no parameters were set.
|
||||
inline const ParameterMap& GetParameters() const { return myShapeProcParams; }
|
||||
|
||||
//! 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.
|
||||
inline const ProcessingFlags& GetShapeProcessFlags() const { return myShapeProcFlags; }
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Transfer_ActorOfFinderProcess,Transfer_ActorOfProcessForFinder)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
Standard_Integer themodetrans;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
ParameterMap myShapeProcParams; //!< Parameters for shape processing.
|
||||
ProcessingFlags myShapeProcFlags; //!< Flags defining operations to be performed on shapes.
|
||||
};
|
||||
|
||||
|
||||
|
@ -17,10 +17,14 @@
|
||||
#include <Transfer_ProcessForTransient.hxx>
|
||||
#include <Transfer_SimpleBinderOfTransient.hxx>
|
||||
#include <Transfer_TransientProcess.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Transfer_ActorOfTransientProcess,Transfer_ActorOfProcessForTransient)
|
||||
|
||||
Transfer_ActorOfTransientProcess::Transfer_ActorOfTransientProcess () { }
|
||||
Transfer_ActorOfTransientProcess::Transfer_ActorOfTransientProcess()
|
||||
{}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Handle(Transfer_Binder) Transfer_ActorOfTransientProcess::Transfer
|
||||
(const Handle(Standard_Transient)& start,
|
||||
@ -32,6 +36,8 @@ Handle(Transfer_Binder) Transfer_ActorOfTransientProcess::Transfer
|
||||
return TransientResult (res);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Handle(Transfer_Binder) Transfer_ActorOfTransientProcess::Transferring
|
||||
(const Handle(Standard_Transient)& ent,
|
||||
const Handle(Transfer_ProcessForTransient)& TP,
|
||||
@ -40,6 +46,8 @@ Handle(Transfer_Binder) Transfer_ActorOfTransientProcess::Transferring
|
||||
return Transfer(ent,Handle(Transfer_TransientProcess)::DownCast(TP), theProgress);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Handle(Standard_Transient) Transfer_ActorOfTransientProcess::TransferTransient
|
||||
(const Handle(Standard_Transient)& /*ent*/,
|
||||
const Handle(Transfer_TransientProcess)& /*TP*/,
|
||||
@ -48,3 +56,41 @@ Handle(Standard_Transient) Transfer_ActorOfTransientProcess::TransferTransient
|
||||
Handle(Standard_Transient) nulres;
|
||||
return nulres;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void Transfer_ActorOfTransientProcess::SetParameters(const ParameterMap& theParameters)
|
||||
{
|
||||
myShapeProcParams = theParameters;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void Transfer_ActorOfTransientProcess::SetParameters(ParameterMap&& theParameters)
|
||||
{
|
||||
myShapeProcParams = std::move(theParameters);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void Transfer_ActorOfTransientProcess::SetParameters(const DE_ShapeFixParameters& theParameters,
|
||||
const ParameterMap& theAdditionalParameters)
|
||||
{
|
||||
myShapeProcParams.clear();
|
||||
XSAlgo_ShapeProcessor::FillParameterMap(theParameters, true, myShapeProcParams);
|
||||
for (const auto& aParam : theAdditionalParameters)
|
||||
{
|
||||
if (myShapeProcParams.find(aParam.first) == myShapeProcParams.end())
|
||||
{
|
||||
myShapeProcParams[aParam.first] = aParam.second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void Transfer_ActorOfTransientProcess::SetProcessingFlags(const ShapeProcess::OperationsFlags& theFlags)
|
||||
{
|
||||
myShapeProcFlags.first = theFlags;
|
||||
myShapeProcFlags.second = true;
|
||||
}
|
||||
|
@ -17,9 +17,13 @@
|
||||
#ifndef _Transfer_ActorOfTransientProcess_HeaderFile
|
||||
#define _Transfer_ActorOfTransientProcess_HeaderFile
|
||||
|
||||
#include <ShapeProcess.hxx>
|
||||
#include <Standard.hxx>
|
||||
|
||||
#include <Transfer_ActorOfProcessForTransient.hxx>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
struct DE_ShapeFixParameters;
|
||||
class Transfer_Binder;
|
||||
class Standard_Transient;
|
||||
class Transfer_ProcessForTransient;
|
||||
@ -31,10 +35,14 @@ DEFINE_STANDARD_HANDLE(Transfer_ActorOfTransientProcess, Transfer_ActorOfProcess
|
||||
//! The original class was renamed. Compatibility only
|
||||
class Transfer_ActorOfTransientProcess : public Transfer_ActorOfProcessForTransient
|
||||
{
|
||||
public:
|
||||
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>;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT Transfer_ActorOfTransientProcess();
|
||||
|
||||
Standard_EXPORT virtual Handle(Transfer_Binder) Transferring
|
||||
@ -52,27 +60,42 @@ public:
|
||||
const Handle(Transfer_TransientProcess)& TP,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! 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 = {});
|
||||
|
||||
//! Returns parameters for shape processing that was set by SetParameters() method.
|
||||
//! @return the parameters for shape processing. Empty map if no parameters were set.
|
||||
inline const ParameterMap& GetParameters() const { return myShapeProcParams; }
|
||||
|
||||
//! Sets flags defining operations to be performed on shapes.
|
||||
//! @param theFlags The flags defining operations to be performed on shapes.
|
||||
Standard_EXPORT void SetProcessingFlags(const ShapeProcess::OperationsFlags& theFlags);
|
||||
|
||||
//! Returns flags defining operations to be performed on shapes.
|
||||
//! @return Pair: the flags defining operations to be performed on shapes and a boolean value that indicates
|
||||
//! whether the flags were set.
|
||||
inline const ProcessingFlags& GetProcessingFlags() const { return myShapeProcFlags; }
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Transfer_ActorOfTransientProcess,Transfer_ActorOfProcessForTransient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
ParameterMap myShapeProcParams; //!< Parameters for shape processing.
|
||||
ProcessingFlags myShapeProcFlags; //!< Flags defining operations to be performed on shapes.
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Transfer_ActorOfTransientProcess_HeaderFile
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <XCAFDoc_ShapeTool.hxx>
|
||||
#include <XDEDRAW_Shapes.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
#include <UnitsMethods.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -62,7 +62,7 @@ static Standard_Integer addShape (Draw_Interpretor& di, Standard_Integer argc, c
|
||||
Standard_Real aLengthUnit = 1.;
|
||||
if (!XCAFDoc_DocumentTool::GetLengthUnit(Doc, aLengthUnit))
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer(); // update unit info
|
||||
aLengthUnit = UnitsMethods::GetCasCadeLengthUnit(UnitsMethods_LengthUnit_Meter);
|
||||
XCAFDoc_DocumentTool::SetLengthUnit(Doc, aLengthUnit);
|
||||
}
|
||||
|
@ -36,13 +36,52 @@
|
||||
#include <Transfer_TransientProcess.hxx>
|
||||
#include <UnitsMethods.hxx>
|
||||
|
||||
#include <sstream>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace
|
||||
{
|
||||
//! Function to split a string based on multiple delimiters.
|
||||
//! @param aString String to split.
|
||||
//! @param delimiters Set of delimiters.
|
||||
//! @return Vector of tokens.
|
||||
std::vector<std::string> splitString(const std::string& aString, const std::unordered_set<char>& delimiters)
|
||||
{
|
||||
std::vector<std::string> aResult;
|
||||
std::string aCurrentToken;
|
||||
|
||||
for (char aCurrentCharacter : aString)
|
||||
{
|
||||
if (delimiters.find(aCurrentCharacter) != delimiters.end())
|
||||
{
|
||||
if (!aCurrentToken.empty())
|
||||
{
|
||||
aResult.emplace_back(std::move(aCurrentToken));
|
||||
aCurrentToken.clear();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aCurrentToken += aCurrentCharacter;
|
||||
}
|
||||
}
|
||||
|
||||
if (!aCurrentToken.empty())
|
||||
{
|
||||
aResult.emplace_back(std::move(aCurrentToken));
|
||||
}
|
||||
|
||||
return aResult;
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
XSAlgo_ShapeProcessor::XSAlgo_ShapeProcessor(const ParameterMap& theParameters,
|
||||
const DE_ShapeFixParameters& theShapeFixParameters)
|
||||
: myParameters(theParameters)
|
||||
{
|
||||
FillParameterMap(theShapeFixParameters, myParameters);
|
||||
FillParameterMap(theShapeFixParameters, false, myParameters);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -50,7 +89,7 @@ XSAlgo_ShapeProcessor::XSAlgo_ShapeProcessor(const ParameterMap& thePar
|
||||
XSAlgo_ShapeProcessor::XSAlgo_ShapeProcessor(const DE_ShapeFixParameters& theParameters)
|
||||
{
|
||||
ParameterMap aMap;
|
||||
FillParameterMap(theParameters, aMap);
|
||||
FillParameterMap(theParameters, false, aMap);
|
||||
myParameters = aMap;
|
||||
}
|
||||
|
||||
@ -440,69 +479,162 @@ Standard_Boolean XSAlgo_ShapeProcessor::CheckPCurve(const TopoDS_Edge& theEd
|
||||
|
||||
//=============================================================================
|
||||
|
||||
XSAlgo_ShapeProcessor::ProcessingData XSAlgo_ShapeProcessor::ReadProcessingData(const std::string& theFileResourceName,
|
||||
const std::string& theScopeResourceName)
|
||||
{
|
||||
const Standard_CString aFileName = Interface_Static::CVal(theFileResourceName.c_str());
|
||||
Handle(ShapeProcess_ShapeContext) aContext = new ShapeProcess_ShapeContext(TopoDS_Shape(), aFileName);
|
||||
if (!aContext->ResourceManager()->IsInitialized())
|
||||
{
|
||||
// If resource file wasn't found, use static values instead
|
||||
Interface_Static::FillMap(aContext->ResourceManager()->GetMap());
|
||||
}
|
||||
const std::string aScope = Interface_Static::CVal(theScopeResourceName.c_str());
|
||||
|
||||
// Copy parameters to the result.
|
||||
ParameterMap aResultParameters;
|
||||
OperationsFlags aResultFlags;
|
||||
const Resource_DataMapOfAsciiStringAsciiString& aMap = aContext->ResourceManager()->GetMap();
|
||||
using RMapIter = Resource_DataMapOfAsciiStringAsciiString::Iterator;
|
||||
for (RMapIter anIter(aMap); anIter.More(); anIter.Next())
|
||||
{
|
||||
std::string aKey = anIter.Key().ToCString();
|
||||
const size_t aScopePosition = aKey.find(aScope);
|
||||
if (aScopePosition != 0)
|
||||
{
|
||||
// Ignore all parameters that don't start with the specified scope.
|
||||
continue;
|
||||
}
|
||||
// Remove the scope from the key + 1 for the dot.
|
||||
// "FromIGES.FixShape.FixFreeFaceMode" -> "FixShape.FixFreeFaceMode"
|
||||
aKey.erase(0, aScope.size() + 1);
|
||||
if (aKey != "exec.op")
|
||||
{
|
||||
// If it is not an operation flag, add it to the parameters.
|
||||
aResultParameters[aKey] = anIter.Value().ToCString();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Parse operations flags.
|
||||
const std::vector<std::string> anOperationStrings = splitString(anIter.Value().ToCString(), {' ', '\t', ',', ';'});
|
||||
for (const auto& anOperationString : anOperationStrings)
|
||||
{
|
||||
std::pair<ShapeProcess::Operation, bool> anOperationFlag = ShapeProcess::ToOperationFlag(anOperationString.c_str());
|
||||
if (anOperationFlag.second)
|
||||
{
|
||||
aResultFlags.set(anOperationFlag.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {aResultParameters, aResultFlags};
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void XSAlgo_ShapeProcessor::FillParameterMap(const DE_ShapeFixParameters& theParameters,
|
||||
const bool theIsReplace,
|
||||
XSAlgo_ShapeProcessor::ParameterMap& theMap)
|
||||
{
|
||||
// Helper lambda to convert enum to string.
|
||||
auto makeString = [](const DE_ShapeFixParameters::FixMode theMode)
|
||||
{
|
||||
return std::to_string(static_cast<std::underlying_type<DE_ShapeFixParameters::FixMode>::type>(theMode));
|
||||
};
|
||||
SetParameter("FixShape.Tolerance3d", theParameters.Tolerance3d, theIsReplace, theMap);
|
||||
SetParameter("FixShape.MaxTolerance3d", theParameters.MaxTolerance3d, theIsReplace, theMap);
|
||||
SetParameter("FixShape.MinTolerance3d", theParameters.MinTolerance3d, theIsReplace, theMap);
|
||||
SetParameter("DetalizationLevel", std::to_string(theParameters.DetalizationLevel), theIsReplace, theMap);
|
||||
SetParameter("NonManifold", std::to_string(theParameters.NonManifold), theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixFreeShellMode", theParameters.FixFreeShellMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixFreeFaceMode", theParameters.FixFreeFaceMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixFreeWireMode", theParameters.FixFreeWireMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixSameParameterMode", theParameters.FixSameParameterMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixSolidMode", theParameters.FixSolidMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixShellOrientationMode", theParameters.FixShellOrientationMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.CreateOpenSolidMode", theParameters.CreateOpenSolidMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixShellMode", theParameters.FixShellMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixFaceOrientationMode", theParameters.FixFaceOrientationMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixFaceMode", theParameters.FixFaceMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixWireMode", theParameters.FixWireMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixOrientationMode", theParameters.FixOrientationMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixAddNaturalBoundMode", theParameters.FixAddNaturalBoundMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixMissingSeamMode", theParameters.FixMissingSeamMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixSmallAreaWireMode", theParameters.FixSmallAreaWireMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.RemoveSmallAreaFaceMode", theParameters.RemoveSmallAreaFaceMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixIntersectingWiresMode", theParameters.FixIntersectingWiresMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixLoopWiresMode", theParameters.FixLoopWiresMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixSplitFaceMode", theParameters.FixSplitFaceMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.AutoCorrectPrecisionMode", theParameters.AutoCorrectPrecisionMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.ModifyTopologyMode", theParameters.ModifyTopologyMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.ModifyGeometryMode", theParameters.ModifyGeometryMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.ClosedWireMode", theParameters.ClosedWireMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.PreferencePCurveMode", theParameters.PreferencePCurveMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixReorderMode", theParameters.FixReorderMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixSmallMode", theParameters.FixSmallMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixConnectedMode", theParameters.FixConnectedMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixEdgeCurvesMode", theParameters.FixEdgeCurvesMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixDegeneratedMode", theParameters.FixDegeneratedMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixLackingMode", theParameters.FixLackingMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixSelfIntersectionMode", theParameters.FixSelfIntersectionMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.RemoveLoopMode", theParameters.RemoveLoopMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixReversed2dMode", theParameters.FixReversed2dMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixRemovePCurveMode", theParameters.FixRemovePCurveMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixRemoveCurve3dMode", theParameters.FixRemoveCurve3dMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixAddPCurveMode", theParameters.FixAddPCurveMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixAddCurve3dMode", theParameters.FixAddCurve3dMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixSeamMode", theParameters.FixSeamMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixShiftedMode", theParameters.FixShiftedMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixEdgeSameParameterMode", theParameters.FixEdgeSameParameterMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixNotchedEdgesMode", theParameters.FixNotchedEdgesMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixTailMode", theParameters.FixTailMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.MaxTailAngle", theParameters.MaxTailAngle, theIsReplace, theMap);
|
||||
SetParameter("FixShape.MaxTailWidth", theParameters.MaxTailWidth, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixSelfIntersectingEdgeMode", theParameters.FixSelfIntersectingEdgeMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixIntersectingEdgesMode", theParameters.FixIntersectingEdgesMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixNonAdjacentIntersectingEdgesMode",
|
||||
theParameters.FixNonAdjacentIntersectingEdgesMode,
|
||||
theIsReplace,
|
||||
theMap);
|
||||
SetParameter("FixShape.FixVertexPositionMode", theParameters.FixVertexPositionMode, theIsReplace, theMap);
|
||||
SetParameter("FixShape.FixVertexToleranceMode", theParameters.FixVertexToleranceMode, theIsReplace, theMap);
|
||||
}
|
||||
|
||||
theMap.emplace("ShapeFix.Tolerance3d", std::to_string(theParameters.Tolerance3d));
|
||||
theMap.emplace("ShapeFix.MaxTolerance3d", std::to_string(theParameters.MaxTolerance3d));
|
||||
theMap.emplace("ShapeFix.MinTolerance3d", std::to_string(theParameters.MinTolerance3d));
|
||||
theMap.emplace("DetalizationLevel", std::to_string(theParameters.DetalizationLevel));
|
||||
theMap.emplace("NonManifold", std::to_string(theParameters.NonManifold));
|
||||
theMap.emplace("ShapeFix.FixFreeShellMode", makeString(theParameters.FixFreeShellMode));
|
||||
theMap.emplace("ShapeFix.FixFreeFaceMode", makeString(theParameters.FixFreeFaceMode));
|
||||
theMap.emplace("ShapeFix.FixFreeWireMode", makeString(theParameters.FixFreeWireMode));
|
||||
theMap.emplace("ShapeFix.FixSameParameterMode", makeString(theParameters.FixSameParameterMode));
|
||||
theMap.emplace("ShapeFix.FixSolidMode", makeString(theParameters.FixSolidMode));
|
||||
theMap.emplace("ShapeFix.FixShellOrientationMode", makeString(theParameters.FixShellOrientationMode));
|
||||
theMap.emplace("ShapeFix.CreateOpenSolidMode", makeString(theParameters.CreateOpenSolidMode));
|
||||
theMap.emplace("ShapeFix.FixShellMode", makeString(theParameters.FixShellMode));
|
||||
theMap.emplace("ShapeFix.FixFaceOrientationMode", makeString(theParameters.FixFaceOrientationMode));
|
||||
theMap.emplace("ShapeFix.FixFaceMode", makeString(theParameters.FixFaceMode));
|
||||
theMap.emplace("ShapeFix.FixWireMode", makeString(theParameters.FixWireMode));
|
||||
theMap.emplace("ShapeFix.FixOrientationMode", makeString(theParameters.FixOrientationMode));
|
||||
theMap.emplace("ShapeFix.FixAddNaturalBoundMode", makeString(theParameters.FixAddNaturalBoundMode));
|
||||
theMap.emplace("ShapeFix.FixMissingSeamMode", makeString(theParameters.FixMissingSeamMode));
|
||||
theMap.emplace("ShapeFix.FixSmallAreaWireMode", makeString(theParameters.FixSmallAreaWireMode));
|
||||
theMap.emplace("ShapeFix.RemoveSmallAreaFaceMode", makeString(theParameters.RemoveSmallAreaFaceMode));
|
||||
theMap.emplace("ShapeFix.FixIntersectingWiresMode", makeString(theParameters.FixIntersectingWiresMode));
|
||||
theMap.emplace("ShapeFix.FixLoopWiresMode", makeString(theParameters.FixLoopWiresMode));
|
||||
theMap.emplace("ShapeFix.FixSplitFaceMode", makeString(theParameters.FixSplitFaceMode));
|
||||
theMap.emplace("ShapeFix.AutoCorrectPrecisionMode", makeString(theParameters.AutoCorrectPrecisionMode));
|
||||
theMap.emplace("ShapeFix.ModifyTopologyMode", makeString(theParameters.ModifyTopologyMode));
|
||||
theMap.emplace("ShapeFix.ModifyGeometryMode", makeString(theParameters.ModifyGeometryMode));
|
||||
theMap.emplace("ShapeFix.ClosedWireMode", makeString(theParameters.ClosedWireMode));
|
||||
theMap.emplace("ShapeFix.PreferencePCurveMode", makeString(theParameters.PreferencePCurveMode));
|
||||
theMap.emplace("ShapeFix.FixReorderMode", makeString(theParameters.FixReorderMode));
|
||||
theMap.emplace("ShapeFix.FixSmallMode", makeString(theParameters.FixSmallMode));
|
||||
theMap.emplace("ShapeFix.FixConnectedMode", makeString(theParameters.FixConnectedMode));
|
||||
theMap.emplace("ShapeFix.FixEdgeCurvesMode", makeString(theParameters.FixEdgeCurvesMode));
|
||||
theMap.emplace("ShapeFix.FixDegeneratedMode", makeString(theParameters.FixDegeneratedMode));
|
||||
theMap.emplace("ShapeFix.FixLackingMode", makeString(theParameters.FixLackingMode));
|
||||
theMap.emplace("ShapeFix.FixSelfIntersectionMode", makeString(theParameters.FixSelfIntersectionMode));
|
||||
theMap.emplace("ShapeFix.RemoveLoopMode", makeString(theParameters.RemoveLoopMode));
|
||||
theMap.emplace("ShapeFix.FixReversed2dMode", makeString(theParameters.FixReversed2dMode));
|
||||
theMap.emplace("ShapeFix.FixRemovePCurveMode", makeString(theParameters.FixRemovePCurveMode));
|
||||
theMap.emplace("ShapeFix.FixRemoveCurve3dMode", makeString(theParameters.FixRemoveCurve3dMode));
|
||||
theMap.emplace("ShapeFix.FixAddPCurveMode", makeString(theParameters.FixAddPCurveMode));
|
||||
theMap.emplace("ShapeFix.FixAddCurve3dMode", makeString(theParameters.FixAddCurve3dMode));
|
||||
theMap.emplace("ShapeFix.FixSeamMode", makeString(theParameters.FixSeamMode));
|
||||
theMap.emplace("ShapeFix.FixShiftedMode", makeString(theParameters.FixShiftedMode));
|
||||
theMap.emplace("ShapeFix.FixEdgeSameParameterMode", makeString(theParameters.FixEdgeSameParameterMode));
|
||||
theMap.emplace("ShapeFix.FixNotchedEdgesMode", makeString(theParameters.FixNotchedEdgesMode));
|
||||
theMap.emplace("ShapeFix.FixTailMode", makeString(theParameters.FixTailMode));
|
||||
theMap.emplace("ShapeFix.MaxTailAngle", makeString(theParameters.MaxTailAngle));
|
||||
theMap.emplace("ShapeFix.MaxTailWidth", makeString(theParameters.MaxTailWidth));
|
||||
theMap.emplace("ShapeFix.FixSelfIntersectingEdgeMode", makeString(theParameters.FixSelfIntersectingEdgeMode));
|
||||
theMap.emplace("ShapeFix.FixIntersectingEdgesMode", makeString(theParameters.FixIntersectingEdgesMode));
|
||||
theMap.emplace("ShapeFix.FixNonAdjacentIntersectingEdgesMode", makeString(theParameters.FixNonAdjacentIntersectingEdgesMode));
|
||||
theMap.emplace("ShapeFix.FixVertexPositionMode", makeString(theParameters.FixVertexPositionMode));
|
||||
theMap.emplace("ShapeFix.FixVertexToleranceMode", makeString(theParameters.FixVertexToleranceMode));
|
||||
//=============================================================================
|
||||
|
||||
void XSAlgo_ShapeProcessor::SetParameter(const char* theKey,
|
||||
DE_ShapeFixParameters::FixMode theValue,
|
||||
const bool theIsReplace,
|
||||
ParameterMap& theMap)
|
||||
{
|
||||
SetParameter(theKey,
|
||||
std::to_string(static_cast<std::underlying_type<DE_ShapeFixParameters::FixMode>::type>(theValue)),
|
||||
theIsReplace,
|
||||
theMap);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void XSAlgo_ShapeProcessor::SetParameter(const char* theKey, double theValue, const bool theIsReplace, ParameterMap& theMap)
|
||||
{
|
||||
// Note that conversion with std::to_string() here is not possible, since it normally preserves only
|
||||
// first 6 significant digits (before C++26). As a result, any value of 1e-7 or below will turn into 0.
|
||||
// By using std::ostringstream with std::scientific formatting we can avoid this limitation.
|
||||
std::ostringstream aStrStream;
|
||||
aStrStream << std::scientific << theValue;
|
||||
SetParameter(theKey, aStrStream.str(), theIsReplace, theMap);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void XSAlgo_ShapeProcessor::SetParameter(const char* theKey,
|
||||
std::string&& theValue,
|
||||
const bool theIsReplace,
|
||||
ParameterMap& theMap)
|
||||
{
|
||||
if (theIsReplace)
|
||||
{
|
||||
theMap[theKey] = std::move(theValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
theMap.emplace(theKey, std::move(theValue));
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -35,6 +35,7 @@ class XSAlgo_ShapeProcessor
|
||||
public:
|
||||
using OperationsFlags = ShapeProcess::OperationsFlags;
|
||||
using ParameterMap = std::unordered_map<std::string, std::string>;
|
||||
using ProcessingData = std::pair<ParameterMap, OperationsFlags>;
|
||||
|
||||
public:
|
||||
//! Constructor.
|
||||
@ -84,10 +85,49 @@ public:
|
||||
const Standard_Real thePrecision,
|
||||
const Standard_Boolean theIsSeam);
|
||||
|
||||
//! Reads the parameter map from and operation flags from the file specified in static interface.
|
||||
//! @param theFileResourceName Name of the parameter in interface static that contains the name
|
||||
//! of the file. For example, parameter "read.iges.resource.name" may contain string "IGES".
|
||||
//! @param theScopeResourceName Name of the parameter in interface static that contains the name
|
||||
//! of the scope. For example, parameter "read.iges.sequence" may contain string "FromIGES".
|
||||
//! @return Read parameter map.
|
||||
Standard_EXPORT static ProcessingData ReadProcessingData(const std::string& theFileResourceName,
|
||||
const std::string& theScopeResourceName);
|
||||
|
||||
//! Fill the parameter map with the values from the specified parameters.
|
||||
//! @param theParameters Parameters to be used in the processing.
|
||||
//! @param theIsForce Flag indicating whether parameter should be replaced if it already exists in the map.
|
||||
//! @param theMap Map to fill.
|
||||
Standard_EXPORT static void FillParameterMap(const DE_ShapeFixParameters& theParameters, ParameterMap& theMap);
|
||||
Standard_EXPORT static void FillParameterMap(const DE_ShapeFixParameters& theParameters,
|
||||
const bool theIsReplace,
|
||||
ParameterMap& theMap);
|
||||
|
||||
//! Set the parameter in the map.
|
||||
//! @param theKey Key of the parameter.
|
||||
//! @param theValue Value of the parameter.
|
||||
//! @param theIsReplace Flag indicating whether parameter should be replaced if it already exists in the map.
|
||||
//! @param theMap Map to set the parameter in.
|
||||
Standard_EXPORT static void SetParameter(const char* theKey,
|
||||
DE_ShapeFixParameters::FixMode theValue,
|
||||
const bool theIsReplace,
|
||||
ParameterMap& theMap);
|
||||
|
||||
//! Set the parameter in the map.
|
||||
//! @param theKey Key of the parameter.
|
||||
//! @param theValue Value of the parameter.
|
||||
//! @param theIsReplace Flag indicating whether parameter should be replaced if it already exists in the map.
|
||||
//! @param theMap Map to set the parameter in.
|
||||
Standard_EXPORT static void SetParameter(const char* theKey, double theValue, const bool theIsReplace, ParameterMap& theMap);
|
||||
|
||||
//! Set the parameter in the map.
|
||||
//! @param theKey Key of the parameter.
|
||||
//! @param theValue Value of the parameter.
|
||||
//! @param theIsReplace Flag indicating whether parameter should be replaced if it already exists in the map.
|
||||
//! @param theMap Map to set the parameter in.
|
||||
Standard_EXPORT static void SetParameter(const char* theKey,
|
||||
std::string&& theValue,
|
||||
const bool theIsReplace,
|
||||
ParameterMap& theMap);
|
||||
|
||||
//! The function is designed to set the length unit for the application before performing a
|
||||
//! transfer operation. It ensures that the length unit is correctly configured based on the
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <Transfer_IteratorOfProcessForTransient.hxx>
|
||||
#include <Transfer_TransientProcess.hxx>
|
||||
#include <Transfer_ActorOfTransientProcess.hxx>
|
||||
#include <XSControl_Controller.hxx>
|
||||
#include <XSControl_Reader.hxx>
|
||||
#include <XSControl_TransferReader.hxx>
|
||||
@ -255,6 +256,7 @@ Standard_Boolean XSControl_Reader::TransferEntity
|
||||
if (start.IsNull()) return Standard_False;
|
||||
const Handle(XSControl_TransferReader) &TR = thesession->TransferReader();
|
||||
TR->BeginTransfer();
|
||||
InitializeMissingParameters();
|
||||
if (TR->TransferOne (start, Standard_True, theProgress) == 0) return Standard_False;
|
||||
TopoDS_Shape sh = TR->ShapeResult(start);
|
||||
//ShapeExtend_Explorer STU;
|
||||
@ -279,6 +281,7 @@ Standard_Integer XSControl_Reader::TransferList
|
||||
Standard_Integer i, nb = list->Length();
|
||||
const Handle(XSControl_TransferReader) &TR = thesession->TransferReader();
|
||||
TR->BeginTransfer();
|
||||
InitializeMissingParameters();
|
||||
ClearShapes();
|
||||
ShapeExtend_Explorer STU;
|
||||
Message_ProgressScope PS(theProgress, NULL, nb);
|
||||
@ -307,6 +310,7 @@ Standard_Integer XSControl_Reader::TransferRoots (const Message_ProgressRange&
|
||||
const Handle(XSControl_TransferReader) &TR = thesession->TransferReader();
|
||||
|
||||
TR->BeginTransfer();
|
||||
InitializeMissingParameters();
|
||||
ClearShapes();
|
||||
ShapeExtend_Explorer STU;
|
||||
Message_ProgressScope PS (theProgress, "Root", nb);
|
||||
@ -483,4 +487,94 @@ void XSControl_Reader::GetStatsTransfer (const Handle(TColStd_HSequenceOfTransie
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void XSControl_Reader::SetParameters(const ParameterMap& theParameters)
|
||||
{
|
||||
if (Handle(Transfer_ActorOfTransientProcess) anActor = GetActor())
|
||||
{
|
||||
anActor->SetParameters(theParameters);
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void XSControl_Reader::SetParameters(ParameterMap&& theParameters)
|
||||
{
|
||||
if (Handle(Transfer_ActorOfTransientProcess) anActor = GetActor())
|
||||
{
|
||||
anActor->SetParameters(std::move(theParameters));
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void XSControl_Reader::SetParameters(const DE_ShapeFixParameters& theParameters, const ParameterMap& theAdditionalParameters)
|
||||
{
|
||||
if (Handle(Transfer_ActorOfTransientProcess) anActor = GetActor())
|
||||
{
|
||||
anActor->SetParameters(theParameters, theAdditionalParameters);
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
const XSControl_Reader::ParameterMap& XSControl_Reader::GetParameters() const
|
||||
{
|
||||
static const ParameterMap anEmptyMap;
|
||||
const Handle(Transfer_ActorOfTransientProcess) anActor = GetActor();
|
||||
return anActor.IsNull() ? anEmptyMap : anActor->GetParameters();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void XSControl_Reader::SetShapeProcessFlags(const ShapeProcess::OperationsFlags& theFlags)
|
||||
{
|
||||
if (Handle(Transfer_ActorOfTransientProcess) anActor = GetActor())
|
||||
{
|
||||
anActor->SetProcessingFlags(theFlags);
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
const XSControl_Reader::ProcessingFlags& XSControl_Reader::GetShapeProcessFlags() const
|
||||
{
|
||||
static const ProcessingFlags anEmptyFlags;
|
||||
const Handle(Transfer_ActorOfTransientProcess) anActor = GetActor();
|
||||
return anActor.IsNull() ? anEmptyFlags : anActor->GetProcessingFlags();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Handle(Transfer_ActorOfTransientProcess) XSControl_Reader::GetActor() const
|
||||
{
|
||||
Handle(XSControl_WorkSession) aSession = WS();
|
||||
if (aSession.IsNull())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Handle(XSControl_TransferReader) aReader = aSession->TransferReader();
|
||||
if (aReader.IsNull())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return aReader->Actor();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void XSControl_Reader::InitializeMissingParameters()
|
||||
{
|
||||
if (GetParameters().empty())
|
||||
{
|
||||
SetParameters(GetDefaultParameters());
|
||||
}
|
||||
if (!GetShapeProcessFlags().second)
|
||||
{
|
||||
SetShapeProcessFlags(GetDefaultShapeProcessFlags());
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,11 @@
|
||||
#ifndef _XSControl_Reader_HeaderFile
|
||||
#define _XSControl_Reader_HeaderFile
|
||||
|
||||
#include <DE_ShapeFixParameters.hxx>
|
||||
#include <ShapeProcess.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <TColStd_SequenceOfTransient.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
@ -30,12 +31,14 @@
|
||||
#include <IFSelect_PrintCount.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
class XSControl_WorkSession;
|
||||
class Interface_InterfaceModel;
|
||||
class Standard_Transient;
|
||||
class Transfer_ActorOfTransientProcess;
|
||||
class TopoDS_Shape;
|
||||
|
||||
|
||||
//! A groundwork to convert a shape to data which complies
|
||||
//! with a particular norm. This data can be that of a whole
|
||||
//! model or that of a specific list of entities in the model.
|
||||
@ -70,9 +73,13 @@ class TopoDS_Shape;
|
||||
class XSControl_Reader
|
||||
{
|
||||
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 Reader from scratch (creates an empty WorkSession)
|
||||
//! A WorkSession or a Controller must be provided before running
|
||||
@ -260,28 +267,68 @@ public:
|
||||
//! Gives statistics about Transfer
|
||||
Standard_EXPORT void GetStatsTransfer (const Handle(TColStd_HSequenceOfTransient)& list, Standard_Integer& nbMapped, Standard_Integer& nbWithResult, Standard_Integer& nbWithFail) 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 = {});
|
||||
|
||||
//! 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;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
//! Returns a sequence of produced shapes
|
||||
Standard_EXPORT TopTools_SequenceOfShape& Shapes();
|
||||
|
||||
//! Returns default parameters for shape fixing.
|
||||
//! This method should be implemented in the derived classes to return default parameters for shape fixing.
|
||||
//! @return Default parameters for shape fixing.
|
||||
virtual DE_ShapeFixParameters GetDefaultParameters() const { return DE_ShapeFixParameters(); }
|
||||
|
||||
//! Returns default flags for shape processing.
|
||||
//! This method should be implemented in the derived classes to return default flags for shape processing.
|
||||
//! @return Default flags for shape processing.
|
||||
virtual ShapeProcess::OperationsFlags GetDefaultShapeProcessFlags() const { return ShapeProcess::OperationsFlags(); }
|
||||
|
||||
private:
|
||||
//! Returns the Actor for the Transfer of an Entity.
|
||||
//! This Actor is used by the Reader to perform the Transfer.
|
||||
//! @return the Actor for the Transfer of an Entity. May be nullptr.
|
||||
Handle(Transfer_ActorOfTransientProcess) GetActor() const;
|
||||
|
||||
//! If parameters haven't yet been provided, initializes them with default values
|
||||
//! provided by GetDefaultParameters() method.
|
||||
void InitializeMissingParameters();
|
||||
|
||||
protected:
|
||||
Standard_Boolean therootsta;
|
||||
TColStd_SequenceOfTransient theroots;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Handle(XSControl_WorkSession) thesession;
|
||||
TopTools_SequenceOfShape theshapes;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
#include <Transfer_IteratorOfProcessForTransient.hxx>
|
||||
#include <Transfer_TransientProcess.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
#include <XSControl_TransferReader.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
#include <XSDRAW.hxx>
|
||||
@ -216,12 +216,16 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI,
|
||||
modepri = Draw::Atoi(str);
|
||||
}
|
||||
|
||||
XSAlgo_ShapeProcessor::ProcessingData aProcessingData =
|
||||
XSAlgo_ShapeProcessor::ReadProcessingData("read.iges.resource.name", "read.iges.sequence");
|
||||
Reader.SetParameters(std::move(aProcessingData.first));
|
||||
Reader.SetShapeProcessFlags(aProcessingData.second);
|
||||
|
||||
if (modepri == 0)
|
||||
{ //fin
|
||||
theDI << "Bye and good luck! \n";
|
||||
break;
|
||||
}
|
||||
|
||||
else if (modepri <= 2)
|
||||
{ // 1 : Visible Roots, 2 : All Roots
|
||||
theDI << "All Geometry Transfer\n";
|
||||
@ -489,6 +493,12 @@ static Standard_Integer testread(Draw_Interpretor& theDI,
|
||||
case IFSelect_RetFail: { theDI << "error during read\n"; return 1; }
|
||||
default: { theDI << "failure\n"; return 1; }
|
||||
}
|
||||
|
||||
XSAlgo_ShapeProcessor::ProcessingData aProcessingData =
|
||||
XSAlgo_ShapeProcessor::ReadProcessingData("read.iges.resource.name", "read.iges.sequence");
|
||||
Reader.SetParameters(std::move(aProcessingData.first));
|
||||
Reader.SetShapeProcessFlags(aProcessingData.second);
|
||||
|
||||
Reader.TransferRoots();
|
||||
TopoDS_Shape shape = Reader.OneShape();
|
||||
DBRep::Set(theArgVec[2], shape);
|
||||
@ -520,6 +530,11 @@ static Standard_Integer brepiges(Draw_Interpretor& theDI,
|
||||
Message_ProgressScope aRootProgress(aProgress->Start(), "Translating", 100);
|
||||
aProgress->Show(aRootProgress);
|
||||
|
||||
XSAlgo_ShapeProcessor::ProcessingData aProcessingData =
|
||||
XSAlgo_ShapeProcessor::ReadProcessingData("write.iges.resource.name", "write.iges.sequence");
|
||||
anIgesWriter.SetParameters(std::move(aProcessingData.first));
|
||||
anIgesWriter.SetShapeProcessFlags(aProcessingData.second);
|
||||
|
||||
Message_ProgressScope aStepProgress(aRootProgress.Next(90), NULL, theNbArgs);
|
||||
for (Standard_Integer i = 1; i < theNbArgs && aStepProgress.More(); i++)
|
||||
{
|
||||
@ -577,6 +592,10 @@ static Standard_Integer testwrite(Draw_Interpretor& theDI,
|
||||
return 1;
|
||||
}
|
||||
IGESControl_Writer Writer;
|
||||
XSAlgo_ShapeProcessor::ProcessingData aProcessingData =
|
||||
XSAlgo_ShapeProcessor::ReadProcessingData("write.iges.resource.name", "write.iges.sequence");
|
||||
Writer.SetParameters(std::move(aProcessingData.first));
|
||||
Writer.SetShapeProcessFlags(aProcessingData.second);
|
||||
Standard_CString filename = theArgVec[1];
|
||||
TopoDS_Shape shape = DBRep::Get(theArgVec[2]);
|
||||
Standard_Boolean ok = Writer.AddShape(shape);
|
||||
@ -810,6 +829,10 @@ static Standard_Integer etest(Draw_Interpretor& theDI,
|
||||
IGESControl_Reader aReader;
|
||||
aReader.ReadFile(theArgVec[1]);
|
||||
aReader.SetReadVisible(Standard_True);
|
||||
XSAlgo_ShapeProcessor::ProcessingData aProcessingData =
|
||||
XSAlgo_ShapeProcessor::ReadProcessingData("read.iges.resource.name", "read.iges.sequence");
|
||||
aReader.SetParameters(std::move(aProcessingData.first));
|
||||
aReader.SetShapeProcessFlags(aProcessingData.second);
|
||||
aReader.TransferRoots();
|
||||
TopoDS_Shape shape = aReader.OneShape();
|
||||
DBRep::Set(theArgVec[2], shape);
|
||||
@ -882,6 +905,11 @@ static Standard_Integer ReadIges(Draw_Interpretor& theDI,
|
||||
return 1;
|
||||
}
|
||||
|
||||
XSAlgo_ShapeProcessor::ProcessingData aProcessingData =
|
||||
XSAlgo_ShapeProcessor::ReadProcessingData("read.iges.resource.name", "read.iges.sequence");
|
||||
aReader.SetParameters(std::move(aProcessingData.first));
|
||||
aReader.SetShapeProcessFlags(aProcessingData.second);
|
||||
|
||||
Handle(TDocStd_Document) aDocument;
|
||||
if (!DDocStd::GetDocument(theArgVec[1], aDocument, Standard_False))
|
||||
{
|
||||
@ -943,6 +971,10 @@ static Standard_Integer WriteIges(Draw_Interpretor& theDI, Standard_Integer theN
|
||||
case 'l': aWriter.SetLayerMode(mode); break;
|
||||
}
|
||||
}
|
||||
XSAlgo_ShapeProcessor::ProcessingData aProcessingData =
|
||||
XSAlgo_ShapeProcessor::ReadProcessingData("write.iges.resource.name", "write.iges.sequence");
|
||||
aWriter.SetParameters(std::move(aProcessingData.first));
|
||||
aWriter.SetShapeProcessFlags(aProcessingData.second);
|
||||
aWriter.Transfer(aDocument, aRootScope.Next());
|
||||
|
||||
if (isModified)
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <UnitsMethods.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
#include <XSDRAW.hxx>
|
||||
|
||||
@ -126,6 +126,10 @@ static Standard_Integer stepread(Draw_Interpretor& theDI,
|
||||
}
|
||||
|
||||
sr.SetSystemLengthUnit(XSDRAW::GetLengthUnit());
|
||||
XSAlgo_ShapeProcessor::ProcessingData aProcessingData =
|
||||
XSAlgo_ShapeProcessor::ReadProcessingData("read.step.resource.name", "read.step.sequence");
|
||||
sr.SetParameters(std::move(aProcessingData.first));
|
||||
sr.SetShapeProcessFlags(aProcessingData.second);
|
||||
|
||||
// nom = "." -> fichier deja lu
|
||||
Standard_Integer i, num, nbs, modepri = 1;
|
||||
@ -282,7 +286,7 @@ static Standard_Integer testreadstep(Draw_Interpretor& theDI,
|
||||
aFileNames[anInd - 1] = theArgVec[anInd];
|
||||
}
|
||||
STEPControl_Controller::Init();
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer(); // update unit info
|
||||
IFSelect_ReturnStatus aReadStat;
|
||||
DESTEP_Parameters aParameters;
|
||||
aParameters.InitFromStatic();
|
||||
@ -292,7 +296,11 @@ static Standard_Integer testreadstep(Draw_Interpretor& theDI,
|
||||
0, aSize,
|
||||
[&](const Standard_Integer theIndex)
|
||||
{
|
||||
STEPControl_Reader aReader;
|
||||
STEPControl_Reader aReader;
|
||||
XSAlgo_ShapeProcessor::ProcessingData aProcessingData =
|
||||
XSAlgo_ShapeProcessor::ReadProcessingData("read.step.resource.name", "read.step.sequence");
|
||||
aReader.SetParameters(std::move(aProcessingData.first));
|
||||
aReader.SetShapeProcessFlags(aProcessingData.second);
|
||||
aReader.SetSystemLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
|
||||
if (useStream)
|
||||
{
|
||||
@ -426,6 +434,10 @@ static Standard_Integer stepwrite(Draw_Interpretor& theDI,
|
||||
Message_ProgressScope aPSRoot(progress->Start(), "Translating", 100);
|
||||
progress->Show(aPSRoot);
|
||||
|
||||
XSAlgo_ShapeProcessor::ProcessingData aProcessingData =
|
||||
XSAlgo_ShapeProcessor::ReadProcessingData("write.step.resource.name", "write.step.sequence");
|
||||
sw.SetParameters(std::move(aProcessingData.first));
|
||||
sw.SetShapeProcessFlags(aProcessingData.second);
|
||||
Standard_Integer stat = sw.Transfer(shape, mode, Standard_True, aPSRoot.Next(90));
|
||||
if (stat == IFSelect_RetDone)
|
||||
{
|
||||
@ -505,7 +517,12 @@ static Standard_Integer testwrite(Draw_Interpretor& theDI,
|
||||
0, aSize,
|
||||
[&](const Standard_Integer theIndex)
|
||||
{
|
||||
STEPControl_Writer aWriter;
|
||||
STEPControl_Writer aWriter;
|
||||
XSAlgo_ShapeProcessor::ProcessingData aProcessingData =
|
||||
XSAlgo_ShapeProcessor::ReadProcessingData("write.step.resource.name", "write.step.sequence");
|
||||
aWriter.SetParameters(std::move(aProcessingData.first));
|
||||
aWriter.SetShapeProcessFlags(aProcessingData.second);
|
||||
|
||||
if (aWriter.Transfer(aShape, STEPControl_AsIs, aParameters) != IFSelect_RetDone)
|
||||
{
|
||||
theDI << "Error: Can't transfer input shape";
|
||||
@ -781,6 +798,11 @@ static Standard_Integer ReadStep(Draw_Interpretor& theDI,
|
||||
Draw::Set(aDocumentName, aDrawDoc);
|
||||
}
|
||||
|
||||
XSAlgo_ShapeProcessor::ProcessingData aProcessingData =
|
||||
XSAlgo_ShapeProcessor::ReadProcessingData("read.step.resource.name", "read.step.sequence");
|
||||
aReader.SetParameters(std::move(aProcessingData.first));
|
||||
aReader.SetShapeProcessFlags(aProcessingData.second);
|
||||
|
||||
if (!aReader.Transfer(aDocument, aRootScope.Next()))
|
||||
{
|
||||
theDI << "Cannot read any relevant data from the STEP file\n";
|
||||
@ -943,6 +965,11 @@ static Standard_Integer WriteStep(Draw_Interpretor& theDI,
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI);
|
||||
Message_ProgressScope aRootScope(aProgress->Start(), "STEP export", isFileMode ? 2 : 1);
|
||||
|
||||
XSAlgo_ShapeProcessor::ProcessingData aProcessingData =
|
||||
XSAlgo_ShapeProcessor::ReadProcessingData("write.step.resource.name", "write.step.sequence");
|
||||
aWriter.SetParameters(std::move(aProcessingData.first));
|
||||
aWriter.SetShapeProcessFlags(aProcessingData.second);
|
||||
|
||||
if (!aLabel.IsNull())
|
||||
{
|
||||
theDI << "Translating label " << aLabelName << " of document " << aDocumentName << " to STEP\n";
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include <VrmlData_Scene.hxx>
|
||||
#include <XCAFDoc_DocumentTool.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ShapeProcessor.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
#include <XSDRAW.hxx>
|
||||
|
||||
@ -165,7 +165,7 @@ static Standard_Integer ReadVrml(Draw_Interpretor& theDI,
|
||||
Standard_Real aScaleFactor = 1.;
|
||||
if (!XCAFDoc_DocumentTool::GetLengthUnit(aDoc, aScaleFactor))
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer();
|
||||
aScaleFactor = UnitsMethods::GetCasCadeLengthUnit();
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ static Standard_Integer WriteVrml(Draw_Interpretor& di, Standard_Integer argc, c
|
||||
Standard_Real aScaleFactorM = 1.;
|
||||
if (!XCAFDoc_DocumentTool::GetLengthUnit(aDoc, aScaleFactorM))
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
|
||||
XSAlgo_ShapeProcessor::PrepareForTransfer(); // update unit info
|
||||
aScaleFactorM = UnitsMethods::GetCasCadeLengthUnit(UnitsMethods_LengthUnit_Meter);
|
||||
}
|
||||
if (!writer.WriteDoc(aDoc, argv[2], aScaleFactorM))
|
||||
|
Loading…
x
Reference in New Issue
Block a user