1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-05 18:16:23 +03:00

0025520: To provide info on what has been done by Shape Process and Shape Fix

Messages are registered in ShapeExtend_MsgRegistrator added to ShapeCutom and ShapeUpgrade packages
All operators of ShapeProcess_OperLibrary are instrumented with MsgRegistrator

0025520: To provide info on what has been done by Shape Process and Shape Fix

Update SHAPE.fr

Fix some messages (minor change)
This commit is contained in:
bugmaster 2014-12-12 14:19:09 +03:00
parent e275de58af
commit da2db6a705
30 changed files with 636 additions and 66 deletions

View File

@ -31,7 +31,14 @@ Sequence d'operateurs: %s
.Sequence.MSG5
Operateur %d/%d: %s
!
.Sequence.MSG
.Sequence.MSG1
Error: Operator %s is not found
!
.Sequence.MSG2
Error: Operator %s failed with exception %s
!
.Sequence.MSG3
Warning: Shape Processing: sequence not defined for %s
!
! ------------------------------------------------------------------------------
! Messages for printing results of shape processing
@ -76,6 +83,9 @@ Detection d'Arete(s) degeneree(s)
.FixWire.FixDegenerated.MSG5
L'Arete n0 %d est degeneree
!
.FixWire.FixCurve3d.Removed
Incomplete edge (with no pcurves or 3d curve) removed
!
.FixAdvWire.FixSmall.MSG0
Petite(s) arete(s) supprimee(s)
!
@ -121,6 +131,26 @@ Contour sur face inverse
.FixAdvFace.FixOrientation.MSG11
Impossible d'orienter le contour
!
! ------------------------------------------------------------------------------
! Messages for ShapeFix_Wireframe
!
.FixWireframe.FixSmallEdges.MSG0
Small edge removed
!
.FixWireframe.FixSmallEdges.MSG1
Small wire removed
!
.FixWireframe.FixSmallEdges.MSG2
Small face removed
!
.FixWireframe.FixFixWireGaps.MSG0
Gaps in a wire fixed
!
!
.Fix.SplitCommonVertex.MSG0
Wires with common vertex fixed
!
!
.FixAdvShell.FixOrientation.MSG20
Impossible d'orienter les faces dans le shell, creation de plusieurs shells
!
@ -136,12 +166,25 @@ L'Orientation du/des shell(s) dans le solida ete corrigee
.FixAdvSolid.FixOrientation.MSG30
Solide avec connexions incorrectes, divise en plusieurs parties
!
.FixAdvFace..MSG0
.FixAdvFace.FixLoopWire.MSG0
Wire was splitted on several wires
!
.FixAdvFace..MSG5
!
.FixAdvFace..MSG10
!
.FixEdge.SameParameter.MSG0
Not same parameter edge fixed
!
! ------------------------------------------------------------------------------
! Messages for ShapeFix_FixSmallFace
!
.FixAdvFace.FixSpotFace.MSG0
Spot face removed
!
.FixAdvFace.FixStripFace.MSG0
Strip face removed
!
! ------------------------------------------------------------------------------
! Messages for ShapeFix_Shell
!
@ -151,9 +194,65 @@ Faces mal orientees dans le shell, corrigees
.FixAdvShell.FixOrientation.MSG5
Faces mal orientees dans le shell, non corrigees
!
.FixAdvShell..MSG0
.FixAdvShell.FixClosedFlag.MSG0
Shell has incorrect flag isClosed
!
.FixAdvShell..MSG5
!
.FixAdvShell..MSG10
!
! ------------------------------------------------------------------------------
! Messages for ShapeUpgrade
!
.ShapeDivide.FaceDivide.MSG0
Face divided
!
.ShapeDivide.WireDivide.MSG0
Wire divided
!
.ShapeDivide.EdgeDivide.MSG0
Edge divided
!
.ShapeDivide.FaceConvertToBezier.MSG0
Face converted to Bezier
!
.ShapeDivide.WireConvertToBezier.MSG0
Wire converted to Bezier
!
.ShapeDivide.EdgeConvertToBezier.MSG0
Edge converted to Bezier
!
! ------------------------------------------------------------------------------
! Messages for ShapeCustom
!
.BSplineRestriction.NewSurface.MSG0
Face converted to BSpline
!
.BSplineRestriction.NewSurface.MSG1
BSpline Face re-approximated
!
.BSplineRestriction.NewCurve.MSG0
Edge converted to BSpline
!
.BSplineRestriction.NewCurve.MSG1
BSpline Edge re-approximated
!
!
.ConvertToBSpline.NewSurface.MSG0
Face converted to BSpline
!
.ConvertToBSpline.NewCurve.MSG0
Edge converted to BSpline
!
!
.ConvertToRevolution.NewSurface.MSG0
Face converted to surface of revolution
!
!
.DirectModification.NewSurface.MSG0
Direction of Face of revolution corrected
!
!
.SweptToElementary.NewSurface.MSG0
Swept Face converted to elementary
!

View File

@ -38,8 +38,7 @@ Error: Operator %s is not found
.Sequence.MSG2
Error: Operator %s failed with exception %s
!
.Sequence.MSG2
Operator %s failed with exception %s
.Sequence.MSG3
Warning: Shape Processing: sequence not defined for %s
!
! ------------------------------------------------------------------------------
@ -84,6 +83,9 @@ Degenerated edge(s) detected
.FixWire.FixDegenerated.MSG5
Degenerated edge %d detected
!
.FixWire.FixCurve3d.Removed
Incomplete edge (with no pcurves or 3d curve) removed
!
.FixAdvWire.FixSmall.MSG0
Small edge(s) removed
!
@ -129,6 +131,26 @@ Wire on face was reversed
.FixAdvFace.FixOrientation.MSG11
Cannot orient wire
!
! ------------------------------------------------------------------------------
! Messages for ShapeFix_Wireframe
!
.FixWireframe.FixSmallEdges.MSG0
Small edge removed
!
.FixWireframe.FixSmallEdges.MSG1
Small wire removed
!
.FixWireframe.FixSmallEdges.MSG2
Small face removed
!
.FixWireframe.FixFixWireGaps.MSG0
Gaps in a wire fixed
!
!
.Fix.SplitCommonVertex.MSG0
Wires with common vertex fixed
!
!
.FixAdvShell.FixOrientation.MSG20
Impossible to orient faces in shell, several shells created
!
@ -151,6 +173,18 @@ Wire was splitted on several wires
!
.FixAdvFace..MSG10
!
.FixEdge.SameParameter.MSG0
Not same parameter edge fixed
!
! ------------------------------------------------------------------------------
! Messages for ShapeFix_FixSmallFace
!
.FixAdvFace.FixSpotFace.MSG0
Spot face removed
!
.FixAdvFace.FixStripFace.MSG0
Strip face removed
!
! ------------------------------------------------------------------------------
! Messages for ShapeFix_Shell
!
@ -167,3 +201,58 @@ Shell has incorrect flag isClosed
!
.FixAdvShell..MSG10
!
! ------------------------------------------------------------------------------
! Messages for ShapeUpgrade
!
.ShapeDivide.FaceDivide.MSG0
Face divided
!
.ShapeDivide.WireDivide.MSG0
Wire divided
!
.ShapeDivide.EdgeDivide.MSG0
Edge divided
!
.ShapeDivide.FaceConvertToBezier.MSG0
Face converted to Bezier
!
.ShapeDivide.WireConvertToBezier.MSG0
Wire converted to Bezier
!
.ShapeDivide.EdgeConvertToBezier.MSG0
Edge converted to Bezier
!
! ------------------------------------------------------------------------------
! Messages for ShapeCustom
!
.BSplineRestriction.NewSurface.MSG0
Face converted to BSpline
!
.BSplineRestriction.NewSurface.MSG1
BSpline Face re-approximated
!
.BSplineRestriction.NewCurve.MSG0
Edge converted to BSpline
!
.BSplineRestriction.NewCurve.MSG1
BSpline Edge re-approximated
!
!
.ConvertToBSpline.NewSurface.MSG0
Face converted to BSpline
!
.ConvertToBSpline.NewCurve.MSG0
Edge converted to BSpline
!
!
.ConvertToRevolution.NewSurface.MSG0
Face converted to surface of revolution
!
!
.DirectModification.NewSurface.MSG0
Direction of Face of revolution corrected
!
!
.SweptToElementary.NewSurface.MSG0
Swept Face converted to elementary
!

View File

@ -43,7 +43,8 @@ uses
TColgp,
Precision,
Message,
ShapeBuild
ShapeBuild,
ShapeExtend
is
@ -55,6 +56,7 @@ is
class RestrictionParameters;
deferred class Modification; -- base class of modifications
class DirectModification;
private class TrsfModification;

View File

@ -14,7 +14,7 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
private class BSplineRestriction from ShapeCustom inherits Modification from BRepTools
private class BSplineRestriction from ShapeCustom inherits Modification from ShapeCustom
---Purpose: this tool intended for aproximation surfaces, curves and pcurves with
-- specified degree , max number of segments, tolerance 2d, tolerance 3d. Specified

View File

@ -70,6 +70,7 @@
#include <Geom_CylindricalSurface.hxx>
#include <Geom_ToroidalSurface.hxx>
#include <ShapeAnalysis.hxx>
#include <Message_Msg.hxx>
static GeomAbs_Shape IntegerToGeomAbsShape(const Standard_Integer i)
{
@ -368,6 +369,20 @@ Standard_Boolean ShapeCustom_BSplineRestriction::NewSurface(const TopoDS_Face& F
Standard_Boolean IsConv = ConvertSurface(aSurface,S,UF,UL,VF,VL,IsOf);
Tol = Precision::Confusion();//mySurfaceError;
if ( IsConv )
{
Standard_Boolean wasBSpline = aSurface->IsKind(STANDARD_TYPE(Geom_BSplineSurface));
Handle(Geom_RectangularTrimmedSurface) rts = Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface);
if ( !rts.IsNull() )
wasBSpline = rts->BasisSurface()->IsKind(STANDARD_TYPE(Geom_BSplineSurface));
if ( wasBSpline )
SendMsg( F, Message_Msg("BSplineRestriction.NewSurface.MSG1"));
else
SendMsg( F, Message_Msg("BSplineRestriction.NewSurface.MSG0"));
}
return IsConv;
}
@ -787,7 +802,7 @@ Standard_Boolean ShapeCustom_BSplineRestriction::NewCurve(const TopoDS_Edge& E,
if(aCurve.IsNull()) {
if(IsConvert) {
C = aCurve;
Tol = TolCur;
Tol = TolCur;
return Standard_True;
}
else return Standard_False;
@ -796,6 +811,19 @@ Standard_Boolean ShapeCustom_BSplineRestriction::NewCurve(const TopoDS_Edge& E,
if(myParameters->ConvertOffsetCurv3d()) IsOf = Standard_False;
Standard_Boolean IsConv = ConvertCurve(aCurve,C,IsConvert,First,Last,TolCur,IsOf);
Tol= BRep_Tool::Tolerance(E);//TolCur;
if ( IsConv )
{
Standard_Boolean wasBSpline = aCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve));
Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(aCurve);
if ( !tc.IsNull() )
wasBSpline = tc->BasisCurve()->IsKind(STANDARD_TYPE(Geom_BSplineCurve));
if ( wasBSpline )
SendMsg( E, Message_Msg("BSplineRestriction.NewCurve.MSG1"));
else
SendMsg( E, Message_Msg("BSplineRestriction.NewCurve.MSG0"));
}
return IsConv;
}

View File

@ -14,7 +14,7 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
private class ConvertToBSpline from ShapeCustom inherits Modification from BRepTools
private class ConvertToBSpline from ShapeCustom inherits Modification from ShapeCustom
---Purpose: implement a modification for BRepTools
-- Modifier algortihm. Converts Surface of

View File

@ -28,6 +28,7 @@
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRep_GCurve.hxx>
#include <BRepTools.hxx>
#include <Message_Msg.hxx>
//=======================================================================
//function : ShapeCustom_ConvertToBSpline
@ -130,6 +131,8 @@ Standard_Boolean ShapeCustom_ConvertToBSpline::NewSurface (const TopoDS_Face& F,
else
S = res;
SendMsg( F, Message_Msg("ConvertToBSpline.NewSurface.MSG0"));
Tol = BRep_Tool::Tolerance(F);
RevWires = Standard_False;
RevFace = Standard_False;
@ -161,6 +164,7 @@ Standard_Boolean ShapeCustom_ConvertToBSpline::NewCurve (const TopoDS_Edge& E,
C = BRep_Tool::Curve ( E, L, f, l );
if ( ! C.IsNull() ) C = Handle(Geom_Curve)::DownCast ( C->Copy() );
Tol = BRep_Tool::Tolerance ( E );
SendMsg( E, Message_Msg("ConvertToBSpline.NewCurve.MSG0"));
return Standard_True;
}
return Standard_False;

View File

@ -14,7 +14,7 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
private class ConvertToRevolution from ShapeCustom inherits Modification from BRepTools
private class ConvertToRevolution from ShapeCustom inherits Modification from ShapeCustom
---Purpose: implements a modification for the BRepTools
-- Modifier algortihm. Converts all elementary

View File

@ -32,6 +32,7 @@
#include <Geom_TrimmedCurve.hxx>
#include <Geom_Line.hxx>
#include <Geom_SurfaceOfRevolution.hxx>
#include <Message_Msg.hxx>
//=======================================================================
//function : ShapeCustom_ConvertToRevolution
@ -158,7 +159,8 @@ Standard_Boolean ShapeCustom_ConvertToRevolution::NewSurface (const TopoDS_Face&
}
else S = Rev;
}
SendMsg( F, Message_Msg("ConvertToRevolution.NewSurface.MSG0"));
Tol = BRep_Tool::Tolerance(F);
RevWires = Standard_False;
RevFace = Standard_False;

View File

@ -15,7 +15,7 @@
-- commercial license or contractual agreement.
class DirectModification from ShapeCustom
inherits Modification from BRepTools
inherits Modification from ShapeCustom
---Purpose: implements a modification for the BRepTools
-- Modifier algortihm. Will redress indirect

View File

@ -32,6 +32,7 @@
#include <BRep_TEdge.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRep_GCurve.hxx>
#include <Message_Msg.hxx>
//=======================================================================
//function : ShapeCustom_DirectModification
@ -111,6 +112,8 @@ Standard_Boolean ShapeCustom_DirectModification::NewSurface (const TopoDS_Face&
default: return Standard_False;
}
SendMsg( F, Message_Msg("DirectModification.NewSurface.MSG0"));
Tol = BRep_Tool::Tolerance(F);
return Standard_True;

View File

@ -0,0 +1,43 @@
-- Copyright (c) 2003-2014 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.
deferred class Modification from ShapeCustom inherits Modification from BRepTools
---Purpose: A base class of Modification's from ShapeCustom.
-- Implements message sending mechanism.
uses
Shape from TopoDS,
Msg from Message,
Gravity from Message,
BasicMsgRegistrator from ShapeExtend
is
SetMsgRegistrator (me:mutable; msgreg: BasicMsgRegistrator from ShapeExtend) is virtual;
---Purpose: Sets message registrator
MsgRegistrator (me) returns BasicMsgRegistrator from ShapeExtend;
---Purpose: Returns message registrator
SendMsg (me; shape : Shape from TopoDS;
message: Msg from Message;
gravity: Gravity from Message = Message_Info);
---Purpose: Sends a message to be attached to the shape.
-- Calls corresponding message of message registrator.
fields
myMsgReg: BasicMsgRegistrator from ShapeExtend;
end SweptToElementary;

View File

@ -0,0 +1,52 @@
// Copyright (c) 1999-2014 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 <ShapeCustom_Modification.ixx>
#include <Message_Gravity.hxx>
#include <Message_Msg.hxx>
#include <ShapeExtend_BasicMsgRegistrator.hxx>
#include <TopoDS_Shape.hxx>
//=======================================================================
//function : SetMsgRegistrator
//purpose :
//=======================================================================
void ShapeCustom_Modification::SetMsgRegistrator(const Handle(ShapeExtend_BasicMsgRegistrator)& msgreg)
{
myMsgReg = msgreg;
}
//=======================================================================
//function : MsgRegistrator
//purpose : Returns message registrator
//=======================================================================
Handle(ShapeExtend_BasicMsgRegistrator) ShapeCustom_Modification::MsgRegistrator() const
{
return myMsgReg;
}
//=======================================================================
//function : SendMsg
//purpose :
//=======================================================================
void ShapeCustom_Modification::SendMsg(const TopoDS_Shape& shape,
const Message_Msg& message,
const Message_Gravity gravity) const
{
if ( !myMsgReg.IsNull() )
myMsgReg->Send (shape, message, gravity);
}

View File

@ -13,7 +13,7 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
private class SweptToElementary from ShapeCustom inherits Modification from BRepTools
private class SweptToElementary from ShapeCustom inherits Modification from ShapeCustom
---Purpose: implements a modification for the BRepTools
-- Modifier algortihm. Converts all elementary

View File

@ -43,6 +43,7 @@
#include <ShapeAnalysis_Surface.hxx>
#include <BRepTools.hxx>
#include <Message_Msg.hxx>
//=======================================================================
@ -163,6 +164,8 @@ Standard_Boolean ShapeCustom_SweptToElementary::NewSurface(const TopoDS_Face& F,
}
}
SendMsg( F, Message_Msg("SweptToElementary.NewSurface.MSG0"));
Tol = BRep_Tool::Tolerance(F);
RevWires = Standard_False;
RevFace = Standard_False;

View File

@ -100,7 +100,8 @@ is
SameParameter (shape : Shape from TopoDS;
enforce : Boolean;
preci : Real = 0.0;
theProgress : ProgressIndicator from Message = 0)
theProgress : ProgressIndicator from Message = 0;
theMsgReg : BasicMsgRegistrator from ShapeExtend = 0)
returns Boolean;
---Purpose : Runs SameParameter from BRepLib with these adaptations :
-- <enforce> forces computations, else they are made only on

View File

@ -69,6 +69,8 @@
#include <TopExp.hxx>
#include <Message_ProgressSentry.hxx>
#include <Message_Msg.hxx>
#include <ShapeExtend_BasicMsgRegistrator.hxx>
//=======================================================================
//function : SameParameter
@ -78,7 +80,8 @@
Standard_Boolean ShapeFix::SameParameter(const TopoDS_Shape& shape,
const Standard_Boolean enforce,
const Standard_Real preci,
const Handle(Message_ProgressIndicator)& theProgress)
const Handle(Message_ProgressIndicator)& theProgress,
const Handle(ShapeExtend_BasicMsgRegistrator)& theMsgReg)
{
// Calculate number of edges
Standard_Integer aNbEdges = 0;
@ -98,6 +101,7 @@ Standard_Boolean ShapeFix::SameParameter(const TopoDS_Shape& shape,
Standard_Boolean iatol = (tol > 0);
Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge;
TopExp_Explorer ex(shape,TopAbs_EDGE);
Message_Msg doneMsg("FixEdge.SameParameter.MSG0");
// Start progress scope (no need to check if progress exists -- it is safe)
Message_ProgressSentry aPSentry(theProgress, "Fixing same parameter problem", 0, 2, 1);
@ -135,6 +139,10 @@ Standard_Boolean ShapeFix::SameParameter(const TopoDS_Shape& shape,
B.SameRange (E,Standard_False);
B.SameParameter (E,Standard_False);
}
else if ( !theMsgReg.IsNull() && !sfe->Status( ShapeExtend_OK ) )
{
theMsgReg->Send( E, doneMsg, Message_Warning );
}
// Complete step in current progress scope
aPSentry.Next();

View File

@ -67,6 +67,7 @@
#include <ShapeAnalysis_DataMapOfShapeListOfReal.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Iterator.hxx>
#include <Message_Msg.hxx>
ShapeFix_FixSmallFace::ShapeFix_FixSmallFace()
{
@ -218,6 +219,7 @@ ShapeFix_FixSmallFace::ShapeFix_FixSmallFace()
Context()->Remove(Ed);
}
Context()->Remove(F);
SendWarning( F, Message_Msg( "FixAdvFace.FixSpotFace.MSG0" ));
return Standard_True;
@ -335,6 +337,7 @@ ShapeFix_FixSmallFace::ShapeFix_FixSmallFace()
Standard_Boolean ShapeFix_FixSmallFace::RemoveFacesInCaseOfStrip(const TopoDS_Face& F) const
{
Context()->Remove(F);
SendWarning( F, Message_Msg( "FixAdvFace.FixStripFace.MSG0" ));
return Standard_True;
}

View File

@ -100,5 +100,6 @@ void ShapeFix_Root::SetMaxTolerance (const Standard_Real maxtol)
const Message_Msg& message,
const Message_Gravity gravity) const
{
myMsgReg->Send (shape, message, gravity);
if ( !myMsgReg.IsNull() )
myMsgReg->Send (shape, message, gravity);
}

View File

@ -30,6 +30,7 @@
#include <TopoDS_Vertex.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <Message_Msg.hxx>
//=======================================================================
@ -132,6 +133,8 @@ void ShapeFix_SplitCommonVertex::Perform()
}
}
if ( !MapVV.IsEmpty() )
SendWarning( Message_Msg( "Fix.SplitCommonVertex.MSG0" ));
}
myShape = Context()->Apply(myShape);

View File

@ -53,6 +53,7 @@
#include <ShapeConstruct.hxx>
#include <ShapeBuild_Edge.hxx>
#include <ShapeAnalysis_TransferParametersProj.hxx>
#include <Message_Msg.hxx>
//=======================================================================
//function : ShapeFix_Wireframe
@ -189,6 +190,8 @@ ShapeFix_Wireframe::ShapeFix_Wireframe(const TopoDS_Shape& shape)
myStatusWireGaps |= ShapeExtend::EncodeStatus( ShapeExtend_DONE2 );
if (sfw->StatusGaps2d(ShapeExtend_FAIL))
myStatusWireGaps |= ShapeExtend::EncodeStatus( ShapeExtend_FAIL2 );
if (sfw->StatusGaps3d(ShapeExtend_DONE) || sfw->StatusGaps2d(ShapeExtend_DONE))
SendWarning( itw.Value(), Message_Msg( "FixWireframe.FixFixWireGaps.MSG0" ));
}
}
@ -208,6 +211,8 @@ ShapeFix_Wireframe::ShapeFix_Wireframe(const TopoDS_Shape& shape)
myStatusWireGaps |= ShapeExtend::EncodeStatus( ShapeExtend_DONE1 );
if (sfw->StatusGaps3d(ShapeExtend_FAIL))
myStatusWireGaps |= ShapeExtend::EncodeStatus( ShapeExtend_FAIL1 );
if (sfw->StatusGaps3d(ShapeExtend_DONE))
SendWarning( expw.Current(), Message_Msg( "FixWireframe.FixFixWireGaps.MSG0" ));
}
//End Part1========================================================
@ -874,11 +879,13 @@ Standard_Boolean ShapeFix_Wireframe::MergeSmallEdges(TopTools_MapOfShape& theSma
{
Context()->Replace(edge1,edge3);
Context()->Remove(edge2);
SendWarning( edge2, Message_Msg("FixWireframe.FixSmallEdges.MSG0"));
}
else
{
Context()->Replace(edge2,edge3);
Context()->Remove(edge1);
SendWarning( edge1, Message_Msg("FixWireframe.FixSmallEdges.MSG0"));
}
if (take_next)
{
@ -954,6 +961,7 @@ Standard_Boolean ShapeFix_Wireframe::MergeSmallEdges(TopTools_MapOfShape& theSma
aTmpShape = Context()->Apply(tmpedge2);
TopoDS_Edge anewedge2 = TopoDS::Edge(aTmpShape);
Context()->Remove(remedge);
SendWarning( remedge, Message_Msg("FixWireframe.FixSmallEdges.MSG0"));
if (theSmallEdges.Contains(remedge))
theSmallEdges.Remove(remedge);
theEdgeToFaces.UnBind(remedge);
@ -1037,6 +1045,7 @@ Standard_Boolean ShapeFix_Wireframe::MergeSmallEdges(TopTools_MapOfShape& theSma
{
SFW->WireData()->Remove (index );
Context()->Remove(edge1);
SendWarning( edge1, Message_Msg("FixWireframe.FixSmallEdges.MSG0"));
if (theSmallEdges.Contains(edge1)) theSmallEdges.Remove(edge1);
theEdgeToFaces.UnBind(edge1);
myStatusSmallEdges |= ShapeExtend::EncodeStatus( ShapeExtend_DONE2 );
@ -1051,6 +1060,7 @@ Standard_Boolean ShapeFix_Wireframe::MergeSmallEdges(TopTools_MapOfShape& theSma
{
SFW->WireData()->Remove (index );
Context()->Remove(edge2);
SendWarning( edge2, Message_Msg("FixWireframe.FixSmallEdges.MSG0"));
if (theSmallEdges.Contains(edge2)) theSmallEdges.Remove(edge2);
theEdgeToFaces.UnBind(edge2);
myStatusSmallEdges |= ShapeExtend::EncodeStatus( ShapeExtend_DONE2 );
@ -1069,9 +1079,11 @@ Standard_Boolean ShapeFix_Wireframe::MergeSmallEdges(TopTools_MapOfShape& theSma
{
SFW->WireData()->Remove(1);
Context()->Remove(edge1);
SendWarning( edge1, Message_Msg("FixWireframe.FixSmallEdges.MSG0"));
theSmallEdges.Remove(edge1);
theEdgeToFaces.UnBind(edge1);
Context()->Remove(aWire);
SendWarning( aWire, Message_Msg("FixWireframe.FixSmallEdges.MSG1"));
myStatusSmallEdges |= ShapeExtend::EncodeStatus( ShapeExtend_DONE2 );
}
}
@ -1084,8 +1096,10 @@ Standard_Boolean ShapeFix_Wireframe::MergeSmallEdges(TopTools_MapOfShape& theSma
face.Orientation(facet.Orientation());
TopoDS_Shape anewShape = Context()->Apply(face);
TopoDS_Iterator aIter(anewShape);
if(!aIter.More())
if(!aIter.More()) {
Context()->Remove(anewShape);
SendWarning( face, Message_Msg("FixWireframe.FixSmallEdges.MSG2"));
}
}
}
}
@ -1313,11 +1327,13 @@ Standard_Boolean ShapeFix_Wireframe::MergeSmallEdges(TopTools_MapOfShape& theSma
{
Context()->Replace(edge1,edge3);
Context()->Remove(edge2);
SendWarning( edge2, Message_Msg("FixWireframe.FixSmallEdges.MSG0"));
}
else
{
Context()->Replace(edge2,edge3);
Context()->Remove(edge1);
SendWarning( edge1, Message_Msg("FixWireframe.FixSmallEdges.MSG0"));
}
if (take_next)
{
@ -1393,6 +1409,7 @@ Standard_Boolean ShapeFix_Wireframe::MergeSmallEdges(TopTools_MapOfShape& theSma
aTmpShape = Context()->Apply(tmpedge2);
TopoDS_Edge anewedge2 = TopoDS::Edge(aTmpShape);
Context()->Remove(remedge);
SendWarning( remedge, Message_Msg("FixWireframe.FixSmallEdges.MSG0"));
if (theSmallEdges.Contains(remedge))
theSmallEdges.Remove(remedge);
theEdgeToFaces.UnBind(remedge);
@ -1476,6 +1493,7 @@ Standard_Boolean ShapeFix_Wireframe::MergeSmallEdges(TopTools_MapOfShape& theSma
{
SFW->WireData()->Remove (index );
Context()->Remove(edge1);
SendWarning( edge1, Message_Msg("FixWireframe.FixSmallEdges.MSG0"));
if (theSmallEdges.Contains(edge1)) theSmallEdges.Remove(edge1);
theEdgeToFaces.UnBind(edge1);
myStatusSmallEdges |= ShapeExtend::EncodeStatus( ShapeExtend_DONE2 );
@ -1490,6 +1508,7 @@ Standard_Boolean ShapeFix_Wireframe::MergeSmallEdges(TopTools_MapOfShape& theSma
{
SFW->WireData()->Remove (index );
Context()->Remove(edge2);
SendWarning( edge2, Message_Msg("FixWireframe.FixSmallEdges.MSG0"));
if (theSmallEdges.Contains(edge2)) theSmallEdges.Remove(edge2);
theEdgeToFaces.UnBind(edge2);
myStatusSmallEdges |= ShapeExtend::EncodeStatus( ShapeExtend_DONE2 );
@ -1508,9 +1527,11 @@ Standard_Boolean ShapeFix_Wireframe::MergeSmallEdges(TopTools_MapOfShape& theSma
{
SFW->WireData()->Remove(1);
Context()->Remove(edge1);
SendWarning( edge1, Message_Msg("FixWireframe.FixSmallEdges.MSG0"));
theSmallEdges.Remove(edge1);
theEdgeToFaces.UnBind(edge1);
Context()->Remove(aWire);
SendWarning( aWire, Message_Msg("FixWireframe.FixSmallEdges.MSG1"));
myStatusSmallEdges |= ShapeExtend::EncodeStatus( ShapeExtend_DONE2 );
}
}

View File

@ -40,7 +40,8 @@ uses
UOperator from ShapeProcess,
ShapeContext from ShapeProcess,
Modification from BRepTools,
DataMapOfShapeShape from TopTools
DataMapOfShapeShape from TopTools,
MsgRegistrator from ShapeExtend
is
@ -50,7 +51,8 @@ is
ApplyModifier (myclass; S: Shape from TopoDS;
context: ShapeContext from ShapeProcess;
M: Modification from BRepTools;
map: in out DataMapOfShapeShape from TopTools)
map: in out DataMapOfShapeShape from TopTools;
msg : MsgRegistrator from ShapeExtend=0)
---Purpose: Applies BRepTools_Modification to a shape,
-- taking into account sharing of components of compounds.
returns Shape from TopoDS;

View File

@ -67,7 +67,8 @@
TopoDS_Shape ShapeProcess_OperLibrary::ApplyModifier (const TopoDS_Shape &S,
const Handle(ShapeProcess_ShapeContext)& context,
const Handle(BRepTools_Modification) &M,
TopTools_DataMapOfShapeShape &map)
TopTools_DataMapOfShapeShape &map,
const Handle(ShapeExtend_MsgRegistrator) &msg)
{
// protect against INTERNAL/EXTERNAL shapes
TopoDS_Shape SF = S.Oriented(TopAbs_FORWARD);
@ -102,7 +103,7 @@ TopoDS_Shape ShapeProcess_OperLibrary::ApplyModifier (const TopoDS_Shape &S,
// Modify the shape
BRepTools_Modifier MD(SF,M);
context->RecordModification ( SF, MD );
context->RecordModification ( SF, MD, msg );
return MD.ModifiedShape(SF).Oriented(S.Orientation());
}
@ -117,10 +118,15 @@ static Standard_Boolean directfaces (const Handle(ShapeProcess_Context)& context
Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext)::DownCast ( context );
if ( ctx.IsNull() ) return Standard_False;
// activate message mechanism if it is supported by context
Handle(ShapeExtend_MsgRegistrator) msg;
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
Handle(ShapeCustom_DirectModification) DM = new ShapeCustom_DirectModification;
DM->SetMsgRegistrator( msg );
TopTools_DataMapOfShapeShape map;
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, DM, map );
ctx->RecordModification ( map );
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, DM, map, msg );
ctx->RecordModification ( map, msg );
ctx->SetResult ( res );
return Standard_True;
}
@ -128,17 +134,29 @@ static Standard_Boolean directfaces (const Handle(ShapeProcess_Context)& context
//=======================================================================
//function : sameparam
//purpose :
//purpose :
//=======================================================================
static Standard_Boolean sameparam (const Handle(ShapeProcess_Context)& context)
{
Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext)::DownCast ( context );
if ( ctx.IsNull() ) return Standard_False;
ShapeFix::SameParameter ( ctx->Result(),
ctx->IntegerVal ( "Force", Standard_False ),
ctx->RealVal ( "Tolerance3d", Precision::Confusion() /* -1 */) );
// WARNING: no update of context yet!
// activate message mechanism if it is supported by context
Handle(ShapeExtend_MsgRegistrator) msg;
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
ShapeFix::SameParameter ( ctx->Result(),
ctx->IntegerVal ( "Force", Standard_False ),
ctx->RealVal ( "Tolerance3d", Precision::Confusion() /* -1 */),
NULL, msg );
if ( !msg.IsNull() )
{
// WARNING: not FULL update of context yet!
Handle(ShapeBuild_ReShape) reshape = new ShapeBuild_ReShape;
ctx->RecordModification( reshape, msg );
}
return Standard_True;
}
@ -175,25 +193,30 @@ static Standard_Boolean settol (const Handle(ShapeProcess_Context)& context)
//=======================================================================
//function : splitangle
//purpose :
//purpose :
//=======================================================================
static Standard_Boolean splitangle (const Handle(ShapeProcess_Context)& context)
{
Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext)::DownCast ( context );
if ( ctx.IsNull() ) return Standard_False;
// activate message mechanism if it is supported by context
Handle(ShapeExtend_MsgRegistrator) msg;
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
ShapeUpgrade_ShapeDivideAngle SDA ( ctx->RealVal ( "Angle", 2*M_PI ), ctx->Result() );
SDA.SetMaxTolerance ( ctx->RealVal ( "MaxTolerance", 1. ) );
SDA.SetMsgRegistrator ( msg );
if ( ! SDA.Perform() && SDA.Status (ShapeExtend_FAIL) ) {
#ifdef OCCT_DEBUG
cout<<"ShapeDivideAngle failed"<<endl;
#endif
return Standard_False;
}
ctx->RecordModification ( SDA.GetContext() );
ctx->RecordModification ( SDA.GetContext(), msg );
ctx->SetResult ( SDA.Result() );
return Standard_True;
}
@ -209,6 +232,10 @@ static Standard_Boolean bsplinerestriction (const Handle(ShapeProcess_Context)&
Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext)::DownCast ( context );
if ( ctx.IsNull() ) return Standard_False;
// activate message mechanism if it is supported by context
Handle(ShapeExtend_MsgRegistrator) msg;
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
Standard_Boolean ModeSurf = ctx->IntegerVal ( "SurfaceMode", Standard_True );
Standard_Boolean ModeC3d = ctx->IntegerVal ( "Curve3dMode", Standard_True );
Standard_Boolean ModeC2d = ctx->IntegerVal ( "Curve2dMode", Standard_True );
@ -249,9 +276,10 @@ static Standard_Boolean bsplinerestriction (const Handle(ShapeProcess_Context)&
new ShapeCustom_BSplineRestriction ( ModeSurf, ModeC3d, ModeC2d,
aTol3d, aTol2d, aCont3d, aCont2d,
aMaxDeg, aMaxSeg, ModeDeg, Rational, aParameters );
LD->SetMsgRegistrator( msg );
TopTools_DataMapOfShapeShape map;
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, LD, map );
ctx->RecordModification ( map );
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, LD, map, msg );
ctx->RecordModification ( map, msg );
ctx->SetResult ( res );
return Standard_True;
}
@ -267,11 +295,15 @@ static Standard_Boolean torevol (const Handle(ShapeProcess_Context)& context)
Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext)::DownCast ( context );
if ( ctx.IsNull() ) return Standard_False;
Handle(ShapeCustom_ConvertToRevolution) CR =
new ShapeCustom_ConvertToRevolution();
// activate message mechanism if it is supported by context
Handle(ShapeExtend_MsgRegistrator) msg;
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
Handle(ShapeCustom_ConvertToRevolution) CR = new ShapeCustom_ConvertToRevolution();
CR->SetMsgRegistrator( msg );
TopTools_DataMapOfShapeShape map;
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, CR, map );
ctx->RecordModification ( map );
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, CR, map, msg );
ctx->RecordModification ( map, msg );
ctx->SetResult ( res );
return Standard_True;
}
@ -287,10 +319,15 @@ static Standard_Boolean swepttoelem (const Handle(ShapeProcess_Context)& context
Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext)::DownCast ( context );
if ( ctx.IsNull() ) return Standard_False;
// activate message mechanism if it is supported by context
Handle(ShapeExtend_MsgRegistrator) msg;
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
Handle(ShapeCustom_SweptToElementary) SE = new ShapeCustom_SweptToElementary();
SE->SetMsgRegistrator( msg );
TopTools_DataMapOfShapeShape map;
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, SE, map );
ctx->RecordModification ( map );
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, SE, map, msg );
ctx->RecordModification ( map, msg );
ctx->SetResult ( res );
return Standard_True;
}
@ -306,6 +343,10 @@ static Standard_Boolean shapetobezier (const Handle(ShapeProcess_Context)& conte
Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext)::DownCast ( context );
if ( ctx.IsNull() ) return Standard_False;
// activate message mechanism if it is supported by context
Handle(ShapeExtend_MsgRegistrator) msg;
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
Standard_Boolean ModeC3d = ctx->BooleanVal ( "Curve3dMode", Standard_False );
Standard_Boolean ModeC2d = ctx->BooleanVal ( "Curve2dMode", Standard_False );
Standard_Boolean ModeSurf = ctx->BooleanVal ( "SurfaceMode", Standard_False );
@ -319,6 +360,7 @@ static Standard_Boolean shapetobezier (const Handle(ShapeProcess_Context)& conte
Standard_Boolean BSplineMode = ctx->BooleanVal ( "BSplineMode", Standard_True );
ShapeUpgrade_ShapeConvertToBezier SCB (ctx->Result());
SCB.SetMsgRegistrator( msg );
SCB.SetSurfaceSegmentMode(SegmentMode);
SCB.SetSurfaceConversion (ModeSurf);
SCB.Set2dConversion (ModeC2d);
@ -349,7 +391,7 @@ static Standard_Boolean shapetobezier (const Handle(ShapeProcess_Context)& conte
return Standard_False;
}
ctx->RecordModification ( SCB.GetContext() );
ctx->RecordModification ( SCB.GetContext(), msg );
ctx->SetResult ( SCB.Result() );
return Standard_True;
}
@ -365,6 +407,10 @@ static Standard_Boolean converttobspline (const Handle(ShapeProcess_Context)& co
Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext)::DownCast ( context );
if ( ctx.IsNull() ) return Standard_False;
// activate message mechanism if it is supported by context
Handle(ShapeExtend_MsgRegistrator) msg;
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
Standard_Boolean extrMode = ctx->BooleanVal ( "LinearExtrusionMode", Standard_True );
Standard_Boolean revolMode = ctx->BooleanVal ( "RevolutionMode", Standard_True );
Standard_Boolean offsetMode = ctx->BooleanVal ( "OffsetMode", Standard_True );
@ -373,10 +419,11 @@ static Standard_Boolean converttobspline (const Handle(ShapeProcess_Context)& co
CBspl->SetExtrusionMode(extrMode);
CBspl->SetRevolutionMode(revolMode);
CBspl->SetOffsetMode(offsetMode);
CBspl->SetMsgRegistrator( msg );
TopTools_DataMapOfShapeShape map;
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, CBspl, map );
ctx->RecordModification ( map );
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier( ctx->Result(), ctx, CBspl, map, msg );
ctx->RecordModification ( map, msg );
ctx->SetResult ( res );
return Standard_True;
}
@ -392,6 +439,10 @@ static Standard_Boolean splitcontinuity (const Handle(ShapeProcess_Context)& con
Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext)::DownCast ( context );
if ( ctx.IsNull() ) return Standard_False;
// activate message mechanism if it is supported by context
Handle(ShapeExtend_MsgRegistrator) msg;
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
Standard_Real aTol = ctx->RealVal ( "Tolerance3d", 1.e-7 );
Standard_Real aTol2D = ctx->RealVal ( "Tolerance2d", 1.e-9 );
GeomAbs_Shape aCrvCont = ctx->ContinuityVal ( "CurveContinuity", GeomAbs_C1 );
@ -403,7 +454,9 @@ static Standard_Boolean splitcontinuity (const Handle(ShapeProcess_Context)& con
tool.SetPCurveCriterion(aCrv2dCont);
tool.SetTolerance(aTol);
tool.SetTolerance2d(aTol2D);
tool.SetMsgRegistrator( msg );
Standard_Real maxTol;
if ( ctx->GetReal ( "MaxTolerance", maxTol ) ) tool.SetMaxTolerance(maxTol);
@ -414,7 +467,7 @@ static Standard_Boolean splitcontinuity (const Handle(ShapeProcess_Context)& con
return Standard_False;
}
ctx->RecordModification ( tool.GetContext() );
ctx->RecordModification ( tool.GetContext(), msg );
ctx->SetResult ( tool.Result() );
return Standard_True;
}
@ -430,7 +483,12 @@ static Standard_Boolean splitclosedfaces (const Handle(ShapeProcess_Context)& co
Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext)::DownCast ( context );
if ( ctx.IsNull() ) return Standard_False;
// activate message mechanism if it is supported by context
Handle(ShapeExtend_MsgRegistrator) msg;
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
ShapeUpgrade_ShapeDivideClosed tool ( ctx->Result() );
tool.SetMsgRegistrator( msg );
Standard_Real closeTol;
if ( ctx->GetReal ( "CloseTolerance", closeTol ) ) tool.SetPrecision(closeTol);
@ -451,7 +509,7 @@ static Standard_Boolean splitclosedfaces (const Handle(ShapeProcess_Context)& co
return Standard_False;
}
ctx->RecordModification ( tool.GetContext() );
ctx->RecordModification ( tool.GetContext(), msg );
ctx->SetResult ( tool.Result() );
return Standard_True;
}
@ -467,10 +525,15 @@ static Standard_Boolean fixfacesize (const Handle(ShapeProcess_Context)& context
Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext)::DownCast ( context );
if ( ctx.IsNull() ) return Standard_False;
// activate message mechanism if it is supported by context
Handle(ShapeExtend_MsgRegistrator) msg;
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
Handle(ShapeBuild_ReShape) reshape = new ShapeBuild_ReShape;
ShapeFix_FixSmallFace FSC;
FSC.SetContext(reshape);
FSC.Init(ctx->Result());
FSC.SetMsgRegistrator ( msg );
Standard_Real aTol;
if ( ctx->GetReal ( "Tolerance", aTol ) ) FSC.SetPrecision (aTol);
@ -479,7 +542,7 @@ static Standard_Boolean fixfacesize (const Handle(ShapeProcess_Context)& context
TopoDS_Shape newsh = FSC.Shape();
if ( newsh != ctx->Result() ) {
ctx->RecordModification ( reshape );
ctx->RecordModification ( reshape, msg );
ctx->SetResult ( newsh );
}
@ -497,17 +560,22 @@ static Standard_Boolean fixwgaps (const Handle(ShapeProcess_Context)& context)
Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext)::DownCast ( context );
if ( ctx.IsNull() ) return Standard_False;
// activate message mechanism if it is supported by context
Handle(ShapeExtend_MsgRegistrator) msg;
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
Standard_Real aTol3d = ctx->RealVal ( "Tolerance3d", Precision::Confusion() );
Handle(ShapeBuild_ReShape) reshape = new ShapeBuild_ReShape;
Handle(ShapeFix_Wireframe) sfwf = new ShapeFix_Wireframe(ctx->Result());
sfwf->SetMsgRegistrator( msg );
sfwf->SetContext(reshape);
sfwf->SetPrecision(aTol3d);
sfwf->FixWireGaps();
TopoDS_Shape result = sfwf->Shape();
if ( result != ctx->Result() ) {
ctx->RecordModification ( reshape );
ctx->RecordModification ( reshape, msg );
ctx->SetResult ( result );
}
return Standard_True;
@ -589,15 +657,20 @@ static Standard_Boolean mergesmalledges (const Handle(ShapeProcess_Context)& con
Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext)::DownCast ( context );
if ( ctx.IsNull() ) return Standard_False;
// activate message mechanism if it is supported by context
Handle(ShapeExtend_MsgRegistrator) msg;
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
Standard_Real aTol3d = ctx->RealVal ( "Tolerance3d", Precision::Confusion() );
Handle(ShapeBuild_ReShape) reshape = new ShapeBuild_ReShape;
ShapeFix_Wireframe ShapeFixWireframe(ctx->Result());
ShapeFixWireframe.SetContext(reshape);
ShapeFixWireframe.SetPrecision(aTol3d);
ShapeFixWireframe.SetMsgRegistrator( msg );
if ( ShapeFixWireframe.FixSmallEdges() ) {
ctx->RecordModification ( reshape );
ctx->RecordModification ( reshape, msg );
}
return Standard_True;
}
@ -618,9 +691,9 @@ static Standard_Boolean fixshape (const Handle(ShapeProcess_Context)& context)
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
sfs->SetMsgRegistrator ( msg );
Handle(ShapeFix_Face) sff = Handle(ShapeFix_Face)::DownCast(sfs->FixFaceTool());
Handle(ShapeFix_Wire) sfw = Handle(ShapeFix_Wire)::DownCast(sfs->FixWireTool());
sfs->SetMsgRegistrator( msg );
sfs->SetPrecision ( ctx->RealVal ( "Tolerance3d", Precision::Confusion() ) );
sfs->SetMinTolerance ( ctx->RealVal ( "MinTolerance3d", Precision::Confusion() ) );
@ -681,7 +754,9 @@ static Standard_Boolean fixshape (const Handle(ShapeProcess_Context)& context)
return Standard_False;
TopoDS_Shape result = sfs->Shape();
if ( result != ctx->Result() ) {
if (( result != ctx->Result() ) ||
( !msg.IsNull() && !msg->MapShape().IsEmpty()))
{
ctx->RecordModification ( sfs->Context(), msg );
ctx->SetResult ( result );
}
@ -700,10 +775,15 @@ static Standard_Boolean spltclosededges (const Handle(ShapeProcess_Context)& con
Handle(ShapeProcess_ShapeContext)::DownCast ( context );
if ( ctx.IsNull() ) return Standard_False;
// activate message mechanism if it is supported by context
Handle(ShapeExtend_MsgRegistrator) msg;
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
Standard_Integer nbSplits = ctx->IntegerVal ( "NbSplitPoints", 1 );
ShapeUpgrade_ShapeDivideClosedEdges tool (ctx->Result());
tool.SetNbSplitPoints(nbSplits);
tool.SetMsgRegistrator( msg );
if ( ! tool.Perform() && tool.Status (ShapeExtend_FAIL) ) {
#ifdef OCCT_DEBUG
@ -712,7 +792,7 @@ static Standard_Boolean spltclosededges (const Handle(ShapeProcess_Context)& con
return Standard_False;
}
ctx->RecordModification ( tool.GetContext() );
ctx->RecordModification ( tool.GetContext(), msg );
ctx->SetResult ( tool.Result() );
return Standard_True;
}
@ -729,16 +809,22 @@ static Standard_Boolean splitcommonvertex (const Handle(ShapeProcess_Context)& c
Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext)::DownCast ( context );
if ( ctx.IsNull() ) return Standard_False;
// activate message mechanism if it is supported by context
Handle(ShapeExtend_MsgRegistrator) msg;
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
Handle(ShapeBuild_ReShape) reshape = new ShapeBuild_ReShape;
ShapeFix_SplitCommonVertex SCV;
SCV.SetContext(reshape);
SCV.Init(ctx->Result());
SCV.SetMsgRegistrator( msg );
SCV.Perform();
TopoDS_Shape newsh = SCV.Shape();
if ( newsh != ctx->Result() ) {
ctx->RecordModification ( reshape );
ctx->RecordModification ( reshape, msg );
ctx->SetResult ( newsh );
}

View File

@ -81,12 +81,14 @@ is
-- with explicit definition of mapping from current
-- result to a new one
RecordModification (me: mutable; repl: DataMapOfShapeShape from TopTools);
RecordModification (me: mutable; repl: DataMapOfShapeShape from TopTools;
msg : MsgRegistrator from ShapeExtend=0);
RecordModification (me: mutable; repl: ReShape from ShapeBuild;
msg : MsgRegistrator from ShapeExtend);
RecordModification (me: mutable; repl: ReShape from ShapeBuild);
RecordModification (me: mutable; sh : Shape from TopoDS;
repl: Modifier from BRepTools);
repl: Modifier from BRepTools;
msg : MsgRegistrator from ShapeExtend=0);
---Purpose: Records modifications and resets result accordingly
-- NOTE: modification of resulting shape should be explicitly
-- defined in the maps along with modifications of subshapes

View File

@ -168,7 +168,9 @@ static void DumpMap (const TopTools_DataMapOfShapeShape &map)
static void RecModif (const TopoDS_Shape &S,
const TopTools_DataMapOfShapeShape &repl,
const Handle(ShapeExtend_MsgRegistrator) &msg,
TopTools_DataMapOfShapeShape &map,
Handle(ShapeExtend_MsgRegistrator) &myMsg,
const TopAbs_ShapeEnum until)
{
TopoDS_Shape r = S;
@ -218,17 +220,35 @@ static void RecModif (const TopoDS_Shape &S,
if ( res != r ) map.Bind ( S.Located(aNullLoc), res );
}
// update messages (messages must be taken from each level in the substitution map)
if ( ! r.IsNull() && ! myMsg.IsNull() &&
! msg.IsNull() && msg->MapShape().Extent() >0 )
{
const ShapeExtend_DataMapOfShapeListOfMsg& msgmap = msg->MapShape();
if ( msgmap.IsBound( r )) {
const Message_ListOfMsg &msglist = msgmap.Find (r);
for (Message_ListIteratorOfListOfMsg iter (msglist); iter.More(); iter.Next())
myMsg->Send ( S, iter.Value(), Message_Warning );
}
else if ( msgmap.IsBound( S )) {
const Message_ListOfMsg &msglist = msgmap.Find (S);
for (Message_ListIteratorOfListOfMsg iter (msglist); iter.More(); iter.Next())
myMsg->Send ( S, iter.Value(), Message_Warning );
}
}
if ( until == TopAbs_SHAPE || S.ShapeType() >= until ) return;
for ( TopoDS_Iterator it(S); it.More(); it.Next() ) {
RecModif ( it.Value(), repl, map, until );
RecModif ( it.Value(), repl, msg, map, myMsg, until );
}
}
void ShapeProcess_ShapeContext::RecordModification (const TopTools_DataMapOfShapeShape &repl)
void ShapeProcess_ShapeContext::RecordModification (const TopTools_DataMapOfShapeShape &repl,
const Handle(ShapeExtend_MsgRegistrator)& msg)
{
if ( repl.Extent() <=0 ) return;
RecModif ( myShape, repl, myMap, myUntil );
RecModif ( myShape, repl, msg, myMap, myMsg, myUntil );
if ( myMap.IsBound(myShape) ) myResult = myMap.Find ( myShape );
#ifdef OCCT_DEBUG
// cout << "Modifier: " << endl; DumpMap (myMap);
@ -274,6 +294,8 @@ static void RecModif (const TopoDS_Shape &S,
! msg.IsNull() && msg->MapShape().Extent() >0 ) {
TopoDS_Shape cur, next = r;
const ShapeExtend_DataMapOfShapeListOfMsg& msgmap = msg->MapShape();
if ( msgmap.IsBound( S ))
next = S;
do {
cur = next;
if (msgmap.IsBound (cur)) {
@ -288,7 +310,7 @@ static void RecModif (const TopoDS_Shape &S,
if ( until == TopAbs_SHAPE || S.ShapeType() >= until ) return;
for ( TopoDS_Iterator it(S,Standard_False,Standard_False); it.More(); it.Next() ) {
for ( TopoDS_Iterator it(S,Standard_False/*,Standard_False*/); it.More(); it.Next() ) {
RecModif ( it.Value(), repl, msg, map, myMsg, until );
}
}
@ -354,11 +376,12 @@ static void ExplodeModifier (const TopoDS_Shape &S,
}
void ShapeProcess_ShapeContext::RecordModification (const TopoDS_Shape &S,
const BRepTools_Modifier &repl)
const BRepTools_Modifier &repl,
const Handle(ShapeExtend_MsgRegistrator)& msg)
{
TopTools_DataMapOfShapeShape map;
ExplodeModifier ( S, repl, map, myUntil );
RecordModification ( map );
RecordModification ( map, msg );
}
//=======================================================================

View File

@ -34,6 +34,7 @@ uses
Adaptor3d,
GeomAdaptor,
Geom2dAPI,
Message,
TopLoc,
TColStd,
TColGeom,

View File

@ -25,7 +25,8 @@ class ShapeConvertToBezier from ShapeUpgrade inherits ShapeDivide from ShapeUpgr
uses
Shape from TopoDS,
FaceDivide from ShapeUpgrade
FaceDivide from ShapeUpgrade,
Msg from Message
is
@ -131,6 +132,10 @@ is
is redefined protected;
---Purpose: Returns the tool for dividing faces.
GetFaceMsg (me) returns Msg from Message is redefined protected;
GetWireMsg (me) returns Msg from Message is redefined protected;
GetEdgeMsg (me) returns Msg from Message is redefined protected;
---Purpose: Returns a message decsribing modification of a shape.
fields
my2dMode : Boolean;

View File

@ -347,5 +347,17 @@ Handle(ShapeUpgrade_FaceDivide) ShapeUpgrade_ShapeConvertToBezier::GetSplitFaceT
tool->SetSplitSurfaceTool(stool);
}
return tool;
}
Message_Msg ShapeUpgrade_ShapeConvertToBezier::GetFaceMsg() const
{
return "ShapeDivide.FaceConvertToBezier.MSG0";
}
Message_Msg ShapeUpgrade_ShapeConvertToBezier::GetWireMsg() const
{
return "ShapeDivide.WireConvertToBezier.MSG0";
}
Message_Msg ShapeUpgrade_ShapeConvertToBezier::GetEdgeMsg() const
{
return "ShapeDivide.EdgeConvertToBezier.MSG0";
}

View File

@ -22,7 +22,10 @@ uses
Shape from TopoDS,
Status from ShapeExtend,
ReShape from ShapeBuild,
FaceDivide from ShapeUpgrade
FaceDivide from ShapeUpgrade,
Msg from Message,
Gravity from Message,
BasicMsgRegistrator from ShapeExtend
is
Create returns ShapeDivide from ShapeUpgrade;
@ -68,7 +71,19 @@ is
SetContext (me: in out; context: ReShape from ShapeBuild);
---Purpose: Sets context with recorded modifications to be applied
-- during next call(s) to Perform(shape,Standard_False)
SetMsgRegistrator (me: in out; msgreg: BasicMsgRegistrator from ShapeExtend) is virtual;
---Purpose: Sets message registrator
MsgRegistrator (me) returns BasicMsgRegistrator from ShapeExtend;
---Purpose: Returns message registrator
SendMsg (me; shape : Shape from TopoDS;
message: Msg from Message;
gravity: Gravity from Message = Message_Info);
---Purpose: Sends a message to be attached to the shape.
-- Calls corresponding message of message registrator.
Status (me; status: Status from ShapeExtend) returns Boolean;
---Purpose: Queries the status of last call to Perform
-- OK : no splitting was done (or no call to Perform)
@ -91,10 +106,16 @@ is
-- 1 - only curve 3d from shared edges.
-- 2 - all curve 3d.
GetFaceMsg (me) returns Msg from Message is virtual protected;
GetWireMsg (me) returns Msg from Message is virtual protected;
GetEdgeMsg (me) returns Msg from Message is virtual protected;
---Purpose: Returns a message decsribing modification of a shape.
fields
mySplitFaceTool: FaceDivide from ShapeUpgrade;
myContext : ReShape from ShapeBuild is protected;
myMsgReg : BasicMsgRegistrator from ShapeExtend is protected;
myShape : Shape from TopoDS is protected;
myResult : Shape from TopoDS is protected;
myPrecision : Real is protected;

View File

@ -33,6 +33,7 @@
#include <ShapeUpgrade_WireDivide.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Message_Msg.hxx>
//=======================================================================
//function : ShapeUpgrade_ShapeDivide
@ -45,6 +46,7 @@ ShapeUpgrade_ShapeDivide::ShapeUpgrade_ShapeDivide() : myStatus(0)
myMaxTol = 1; //Precision::Infinite() ?? pdn
mySplitFaceTool = new ShapeUpgrade_FaceDivide;
myContext = new ShapeBuild_ReShape;
//myMsgReg = new ShapeExtend_BasicMsgRegistrator;
mySegmentMode = Standard_True;
myEdgeMode = 2;
}
@ -187,6 +189,8 @@ Standard_Boolean ShapeUpgrade_ShapeDivide::Perform(const Standard_Boolean newCon
SplitWire->SetMinTolerance(myMinTol);
SplitWire->SetEdgeMode(myEdgeMode);
}
Message_Msg doneMsg = GetFaceMsg();
for(TopExp_Explorer exp(myShape,TopAbs_FACE); exp.More(); exp.Next()) {
//smh#8
TopoDS_Shape tmpF = exp.Current().Oriented ( TopAbs_FORWARD );
@ -206,6 +210,7 @@ Standard_Boolean ShapeUpgrade_ShapeDivide::Perform(const Standard_Boolean newCon
}
if(SplitFace->Status(ShapeExtend_DONE)) {
myContext->Replace(face,SplitFace->Result());
SendMsg( face, doneMsg, Message_Info );
if(SplitFace->Status(ShapeExtend_DONE1))
myStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE1 );
if(SplitFace->Status(ShapeExtend_DONE2))
@ -232,6 +237,8 @@ Standard_Boolean ShapeUpgrade_ShapeDivide::Perform(const Standard_Boolean newCon
SplitWire->SetMaxTolerance(myMaxTol);
SplitWire->SetMinTolerance(myMinTol);
SplitWire->SetEdgeMode(myEdgeMode);
Message_Msg doneMsg = GetWireMsg();
TopExp_Explorer exp;//svv Jan 10 2000 : porting on DEC
for (exp.Init (myShape, TopAbs_WIRE, TopAbs_FACE); exp.More(); exp.Next()) {
//smh#8
@ -248,12 +255,14 @@ Standard_Boolean ShapeUpgrade_ShapeDivide::Perform(const Standard_Boolean newCon
}
if(SplitWire->Status(ShapeExtend_DONE)) {
myContext->Replace(wire,SplitWire->Wire());
SendMsg( wire, doneMsg, Message_Info );
myStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE1 );
}
}
}
// Process free EDGEs
Message_Msg edgeDoneMsg = GetEdgeMsg();
for (exp.Init (myShape, TopAbs_EDGE, TopAbs_WIRE); exp.More(); exp.Next()) {
//smh#8
TopoDS_Shape tmpE = exp.Current().Oriented ( TopAbs_FORWARD );
@ -272,6 +281,7 @@ Standard_Boolean ShapeUpgrade_ShapeDivide::Perform(const Standard_Boolean newCon
}
if(SplitWire->Status(ShapeExtend_DONE)) {
myContext->Replace(edge,SplitWire->Wire());
SendMsg( edge, edgeDoneMsg, Message_Info );
myStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE1 );
}
}
@ -351,3 +361,49 @@ Standard_Boolean ShapeUpgrade_ShapeDivide::Status (const ShapeExtend_Status stat
{
myEdgeMode = aEdgeMode;
}
//=======================================================================
//function : SetMsgRegistrator
//purpose :
//=======================================================================
void ShapeUpgrade_ShapeDivide::SetMsgRegistrator(const Handle(ShapeExtend_BasicMsgRegistrator)& msgreg)
{
myMsgReg = msgreg;
}
//=======================================================================
//function : MsgRegistrator
//purpose :
//=======================================================================
Handle(ShapeExtend_BasicMsgRegistrator) ShapeUpgrade_ShapeDivide::MsgRegistrator() const
{
return myMsgReg;
}
//=======================================================================
//function : SendMsg
//purpose :
//=======================================================================
void ShapeUpgrade_ShapeDivide::SendMsg(const TopoDS_Shape& shape,
const Message_Msg& message,
const Message_Gravity gravity) const
{
if ( !myMsgReg.IsNull() )
myMsgReg->Send (shape, message, gravity);
}
Message_Msg ShapeUpgrade_ShapeDivide::GetFaceMsg() const
{
return "ShapeDivide.FaceDivide.MSG0";
}
Message_Msg ShapeUpgrade_ShapeDivide::GetWireMsg() const
{
return "ShapeDivide.WireDivide.MSG0";
}
Message_Msg ShapeUpgrade_ShapeDivide::GetEdgeMsg() const
{
return "ShapeDivide.EdgeDivide.MSG0";
}