Skip to content

Commit

Permalink
Data Exchange - Update Readers with ShapeHealing parameters
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
AtheneNoctuaPt committed Jan 7, 2025
1 parent 3d6c211 commit 3cde7a9
Show file tree
Hide file tree
Showing 32 changed files with 1,148 additions and 652 deletions.
2 changes: 1 addition & 1 deletion src/DE/DE_ShapeFixParameters.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,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;
Expand Down
1 change: 1 addition & 0 deletions src/IGESCAFControl/IGESCAFControl_Writer.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
56 changes: 39 additions & 17 deletions src/IGESControl/IGESControl_ActorWrite.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,19 @@
#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;
SetParameters(GetDefaultParams());
}

//=============================================================================

Standard_Boolean IGESControl_ActorWrite::Recognize
(const Handle(Transfer_Finder)& start)
Expand All @@ -50,40 +58,40 @@ 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();
if (themodetrans < 0 || themodetrans > 1) return NullResult();
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());
ShapeProcess::OperationsFlags aFlags;
aFlags.set(ShapeProcess::Operation::DirectFaces);
shape = aShapeProcessor.ProcessShape(shape, aFlags, 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);
Expand Down Expand Up @@ -111,3 +119,17 @@ Handle(Transfer_Binder) IGESControl_ActorWrite::Transfer

return NullResult();
}

//=============================================================================

IGESControl_ActorWrite::ParameterMap IGESControl_ActorWrite::GetDefaultParams()
{
static ParameterMap aParams;
if (aParams.empty())
{
DE_ShapeFixParameters aShapeFixParameters;
aShapeFixParameters.DetalizationLevel = TopAbs_EDGE;
XSAlgo_ShapeProcessor::FillParameterMap(aShapeFixParameters, false, aParams);
}
return aParams;
}
24 changes: 6 additions & 18 deletions src/IGESControl/IGESControl_ActorWrite.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -50,21 +47,12 @@ public:
const Handle(Transfer_FinderProcess)& FP,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;



//! Returns the default parameters for shape processing.
//! These parameters are used by default in the constructor.
//! @return the default parameters for shape processing.
Standard_EXPORT static ParameterMap GetDefaultParams();

DEFINE_STANDARD_RTTIEXT(IGESControl_ActorWrite,Transfer_ActorOfFinderProcess)

protected:




private:




};


Expand Down
20 changes: 20 additions & 0 deletions src/IGESControl/IGESControl_Reader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
//abv 10.04.99 S4136: eliminate using BRepAPI::Precision()

#include <BRepLib.hxx>
#include <DE_ShapeFixParameters.hxx>
#include <IFSelect_CheckCounter.hxx>
#include <IFSelect_Functions.hxx>
#include <IGESControl_Controller.hxx>
Expand All @@ -35,6 +36,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>
Expand Down Expand Up @@ -312,3 +314,21 @@ void IGESControl_Reader::PrintTransferInfo
}
}
}

//=============================================================================

IGESToBRep_Actor::ParameterMap IGESControl_Reader::GetDefaultParams()
{
static ParameterMap aParams;
if (aParams.empty())
{
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;
aShapeFixParameters.MaxTailWidth = DE_ShapeFixParameters::FixMode::FixOrNot;
XSAlgo_ShapeProcessor::FillParameterMap(aShapeFixParameters, false, aParams);
}
return aParams;
}
28 changes: 5 additions & 23 deletions src/IGESControl/IGESControl_Reader.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@
#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;


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.
Expand Down Expand Up @@ -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();
Expand All @@ -96,29 +91,16 @@ public:
//! Prints Statistics and check list for Transfer
Standard_EXPORT void PrintTransferInfo (const IFSelect_PrintFail failwarn, const IFSelect_PrintCount mode) const;




protected:




//! Returns the default parameters for shape processing.
//! These parameters are used by default in the constructor.
//! @return the default parameters for shape processing.
Standard_EXPORT static ParameterMap GetDefaultParams();

private:



Standard_Boolean theReadOnlyVisible;


};


#include <IGESControl_Reader.lxx>





#endif // _IGESControl_Reader_HeaderFile
Loading

0 comments on commit 3cde7a9

Please sign in to comment.