mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0022746: Progress indicator in ShapeHealing
This commit is contained in:
@@ -18,15 +18,16 @@ uses
|
||||
ShapeExtend,
|
||||
ShapeAnalysis,
|
||||
ShapeFix,
|
||||
Transfer
|
||||
Transfer,
|
||||
Message
|
||||
|
||||
is
|
||||
|
||||
enumeration Caller is
|
||||
---Purpose: Identifies the caller of the algorithm
|
||||
DEFAULT,
|
||||
IGES,
|
||||
STEP
|
||||
DEFAULT,
|
||||
IGES,
|
||||
STEP
|
||||
end Caller;
|
||||
|
||||
class ToolContainer;
|
||||
|
@@ -11,18 +11,19 @@ class AlgoContainer from XSAlgo inherits TShared from MMgt
|
||||
|
||||
uses
|
||||
|
||||
Curve from Geom2d,
|
||||
Surface from Geom,
|
||||
Edge from TopoDS,
|
||||
Face from TopoDS,
|
||||
Shape from TopoDS,
|
||||
Caller from XSAlgo,
|
||||
ToolContainer from XSAlgo,
|
||||
WireData from ShapeExtend,
|
||||
Wire from ShapeAnalysis,
|
||||
Wire from ShapeFix,
|
||||
TransientProcess from Transfer,
|
||||
FinderProcess from Transfer
|
||||
Curve from Geom2d,
|
||||
Surface from Geom,
|
||||
Edge from TopoDS,
|
||||
Face from TopoDS,
|
||||
Shape from TopoDS,
|
||||
Caller from XSAlgo,
|
||||
ToolContainer from XSAlgo,
|
||||
WireData from ShapeExtend,
|
||||
Wire from ShapeAnalysis,
|
||||
Wire from ShapeFix,
|
||||
TransientProcess from Transfer,
|
||||
FinderProcess from Transfer,
|
||||
ProgressIndicator from Message
|
||||
|
||||
is
|
||||
|
||||
@@ -40,65 +41,59 @@ is
|
||||
|
||||
PrepareForTransfer (me) is virtual;
|
||||
---Purpose: Performs actions necessary for preparing environment
|
||||
-- for transfer. Empty in Open version.
|
||||
-- for transfer. Empty in Open version.
|
||||
|
||||
-- PerformFixShape (me; shape : Shape from TopoDS;
|
||||
-- TP : TransientProcess from Transfer;
|
||||
-- Prec, MaxTol: Real)
|
||||
-- returns Shape from TopoDS is virtual;
|
||||
---Purpose: Applies fixes to the shape resulting from transfer,
|
||||
-- and updates map of entity-shape in TP in accordance with
|
||||
-- substitutions made during fixes (if any)
|
||||
|
||||
ProcessShape (me; shape: Shape from TopoDS;
|
||||
Prec, MaxTol: Real;
|
||||
rscfile: CString;
|
||||
seq: CString;
|
||||
info: out Transient)
|
||||
ProcessShape (me; shape:
|
||||
Shape from TopoDS;
|
||||
Prec, MaxTol: Real;
|
||||
rscfile: CString;
|
||||
seq: CString;
|
||||
info: out Transient;
|
||||
progress: ProgressIndicator from Message = 0)
|
||||
returns Shape from TopoDS is virtual;
|
||||
---Purpose: Does shape processing with specified tolerances
|
||||
-- and returns resulting shape and associated information
|
||||
-- in the form of Transient.
|
||||
-- This information should be later transmitted to
|
||||
-- MergeTransferInfo in order to be recorded in the
|
||||
-- translation map
|
||||
--
|
||||
---Default behaviour:
|
||||
-- Applies sequence with name identified by parameter named
|
||||
-- <seq> (see Interface_Static), defined in resource file
|
||||
-- identified by parameter with name <rscfile>, to shape,
|
||||
-- and keeps info of substitutions made during the process.
|
||||
-- The Prec and MaxTol define run-time parameters
|
||||
-- Runtime.Tolerance and Runtime.MaxTolerance which can be
|
||||
-- referred from the resource file
|
||||
-- ("param : &Runtime.Tolerance")
|
||||
-- In the info returns ShapeProcess_ShapeContext with recorded
|
||||
-- modifications. If info has already this type on input, uses it.
|
||||
--
|
||||
-- If resource file is not found, or sequence is not defined
|
||||
-- there, performs default fixes:
|
||||
-- - if <seq> is write.iges.sequence or write.step.sequence, does DirectFaces
|
||||
-- - if <seq> is read.iges.sequence or read.step.sequence, performs FixShape
|
||||
-- in the form of Transient.
|
||||
-- This information should be later transmitted to
|
||||
-- MergeTransferInfo in order to be recorded in the
|
||||
-- translation map
|
||||
--
|
||||
---Default behaviour:
|
||||
-- Applies sequence with name identified by parameter named
|
||||
-- <seq> (see Interface_Static), defined in resource file
|
||||
-- identified by parameter with name <rscfile>, to shape,
|
||||
-- and keeps info of substitutions made during the process.
|
||||
-- The Prec and MaxTol define run-time parameters
|
||||
-- Runtime.Tolerance and Runtime.MaxTolerance which can be
|
||||
-- referred from the resource file
|
||||
-- ("param : &Runtime.Tolerance")
|
||||
-- In the info returns ShapeProcess_ShapeContext with recorded
|
||||
-- modifications. If info has already this type on input, uses it.
|
||||
--
|
||||
-- If resource file is not found, or sequence is not defined
|
||||
-- there, performs default fixes:
|
||||
-- - if <seq> is write.iges.sequence or write.step.sequence, does DirectFaces
|
||||
-- - if <seq> is read.iges.sequence or read.step.sequence, performs FixShape
|
||||
|
||||
CheckPCurve (me; edge : Edge from TopoDS;
|
||||
face : Face from TopoDS;
|
||||
preci : Real;
|
||||
isSeam: Boolean)
|
||||
face : Face from TopoDS;
|
||||
preci : Real;
|
||||
isSeam: Boolean)
|
||||
returns Boolean is virtual;
|
||||
---Purpose: Checks quality of pcurve of the edge on the given face,
|
||||
-- and corrects it if necessary.
|
||||
---Remark : In Open CASCADE does nothing.
|
||||
-- and corrects it if necessary.
|
||||
---Remark : In Open CASCADE does nothing.
|
||||
|
||||
MergeTransferInfo (me; TP : TransientProcess from Transfer;
|
||||
info: Transient;
|
||||
startTPitem: Integer = 1) is virtual;
|
||||
info: Transient;
|
||||
startTPitem: Integer = 1) is virtual;
|
||||
MergeTransferInfo (me; FP : FinderProcess from Transfer;
|
||||
info: Transient) is virtual;
|
||||
---Purpose: Updates translation map (TP or FP) with information
|
||||
-- resulting from ShapeProcessing
|
||||
-- Parameter startTPitem can be used for optimisation, to
|
||||
-- restrict modifications to entities stored in TP starting
|
||||
-- from item startTPitem
|
||||
info: Transient) is virtual;
|
||||
---Purpose: Updates translation map (TP or FP) with information
|
||||
-- resulting from ShapeProcessing
|
||||
-- Parameter startTPitem can be used for optimisation, to
|
||||
-- restrict modifications to entities stored in TP starting
|
||||
-- from item startTPitem
|
||||
|
||||
fields
|
||||
|
||||
|
@@ -80,16 +80,21 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape (const TopoDS_Shape& shape,
|
||||
const Standard_Real maxTol,
|
||||
const Standard_CString prscfile,
|
||||
const Standard_CString pseq,
|
||||
Handle(Standard_Transient)& info) const
|
||||
Handle(Standard_Transient)& info,
|
||||
const Handle(Message_ProgressIndicator)& progress) const
|
||||
{
|
||||
if ( shape.IsNull() ) return shape;
|
||||
|
||||
Handle(ShapeProcess_ShapeContext) context = Handle(ShapeProcess_ShapeContext)::DownCast ( info );
|
||||
if ( context.IsNull() ) {
|
||||
Standard_CString rscfile = Interface_Static::CVal ( prscfile );
|
||||
if ( ! rscfile ) rscfile = prscfile;
|
||||
context = new ShapeProcess_ShapeContext (shape, rscfile);
|
||||
context->SetDetalisation ( TopAbs_EDGE );
|
||||
Handle(ShapeProcess_ShapeContext) context = Handle(ShapeProcess_ShapeContext)::DownCast(info);
|
||||
if ( context.IsNull() )
|
||||
{
|
||||
Standard_CString rscfile = Interface_Static::CVal(prscfile);
|
||||
if (!rscfile)
|
||||
rscfile = prscfile;
|
||||
context = new ShapeProcess_ShapeContext(shape, rscfile);
|
||||
context->SetDetalisation(TopAbs_EDGE);
|
||||
if ( !progress.IsNull() )
|
||||
context->SetProgress(progress);
|
||||
}
|
||||
info = context;
|
||||
|
||||
@@ -123,7 +128,7 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape (const TopoDS_Shape& shape,
|
||||
sfs->SetMaxTolerance ( maxTol );
|
||||
sfs->FixFaceTool()->FixWireTool()->FixSameParameterMode() = Standard_False;
|
||||
sfs->FixSolidTool()->CreateOpenSolidMode() = Standard_False;
|
||||
sfs->Perform();
|
||||
sfs->Perform(progress);
|
||||
|
||||
TopoDS_Shape S = sfs->Shape();
|
||||
if ( ! S.IsNull() && S != shape ) {
|
||||
@@ -151,8 +156,10 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape (const TopoDS_Shape& shape,
|
||||
// Define runtime tolerances and do Shape Processing
|
||||
rsc->SetResource ( "Runtime.Tolerance", Prec );
|
||||
rsc->SetResource ( "Runtime.MaxTolerance", maxTol );
|
||||
ShapeProcess::Perform ( context, seq );
|
||||
|
||||
|
||||
if ( !ShapeProcess::Perform(context, seq) )
|
||||
return TopoDS_Shape(); // Null shape
|
||||
|
||||
return context->Result();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user