From fb42c34bd2bff56e9411ff4b5a993565c4d60baf Mon Sep 17 00:00:00 2001 From: pkv Date: Fri, 25 Sep 2015 07:12:10 +0300 Subject: [PATCH] 0026619: Tolerances of operands are modified using bop The fix forces creation of new sub-shapes (vertex, edge) when the tolerance of some sub-shape of an argument is to be increased. This new behavior is turned off by default. It can be turned on using two ways: 1) Setting 'locking' flag of the arguments. 2) Calling the method SetNonDestructive(Standard_True) of the class BOPAlgo_PaveFiller. --- src/BOPAlgo/BOPAlgo_Builder.cxx | 33 +++- src/BOPAlgo/BOPAlgo_Builder_2.cxx | 6 +- src/BOPAlgo/BOPAlgo_CheckerSI.cdl | 15 -- src/BOPAlgo/BOPAlgo_CheckerSI.cxx | 16 -- src/BOPAlgo/BOPAlgo_PaveFiller.cdl | 66 +++++++ src/BOPAlgo/BOPAlgo_PaveFiller.cxx | 55 +++++- src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx | 17 +- src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx | 230 +++++++++++++++++++++++++ src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx | 41 ++--- src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx | 62 +++---- src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx | 36 ++-- src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx | 73 ++++---- src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx | 198 +++++++++++++++++---- src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx | 77 ++++++++- src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx | 2 - src/BOPAlgo/FILES | 3 +- src/BOPDS/BOPDS_DS.cdl | 15 +- src/BOPDS/BOPDS_DS.cxx | 213 ++++++++++++++++------- src/BOPTools/BOPTools_AlgoTools.cdl | 25 +-- src/BOPTools/BOPTools_AlgoTools_1.cxx | 153 +++++++++++----- src/IntTools/IntTools_Context.cdl | 36 +++- src/IntTools/IntTools_Context.cxx | 38 +++- src/IntTools/IntTools_ShrunkRange.cxx | 6 +- src/QABugs/QABugs_19.cxx | 4 +- tests/boolean/bopcut_2d/D5 | 2 - tests/boolean/gdml_private/G7 | 2 +- tests/boolean/gdml_private/I6 | 4 +- tests/boolean/volumemaker/B3 | 2 +- tests/bugs/modalg_2/bug472_1 | 4 - tests/bugs/modalg_2/bug472_2 | 7 +- tests/bugs/modalg_2/bug472_3 | 10 +- tests/bugs/modalg_5/bug25043 | 6 +- 32 files changed, 1107 insertions(+), 350 deletions(-) create mode 100644 src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx diff --git a/src/BOPAlgo/BOPAlgo_Builder.cxx b/src/BOPAlgo/BOPAlgo_Builder.cxx index 089f47ccd4..52cab4580b 100644 --- a/src/BOPAlgo/BOPAlgo_Builder.cxx +++ b/src/BOPAlgo/BOPAlgo_Builder.cxx @@ -23,9 +23,15 @@ #include #include +#include + +#include +#include + #include #include + //======================================================================= //function : //purpose : @@ -421,17 +427,30 @@ void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) PostTreat(); } -// -// myErrorStatus -// -// 0 - Ok -// //======================================================================= //function : PostTreat //purpose : //======================================================================= void BOPAlgo_Builder::PostTreat() { - BOPTools_AlgoTools::CorrectTolerances(myShape, 0.05, myRunParallel); - BOPTools_AlgoTools::CorrectShapeTolerances(myShape, myRunParallel); + Standard_Integer i, aNbS; + TopAbs_ShapeEnum aType; + BOPCol_IndexedMapOfShape aMA; + if (myPaveFiller->NonDestructive()) { + // MapToAvoid + aNbS=myDS->NbSourceShapes(); + for (i=0; iShapeInfo(i); + aType=aSI.ShapeType(); + if (aType==TopAbs_VERTEX || + aType==TopAbs_EDGE|| + aType==TopAbs_FACE) { + const TopoDS_Shape& aS=aSI.Shape(); + aMA.Add(aS); +} + } + } + // + BOPTools_AlgoTools::CorrectTolerances(myShape, aMA, 0.05, myRunParallel); + BOPTools_AlgoTools::CorrectShapeTolerances(myShape, aMA, myRunParallel); } diff --git a/src/BOPAlgo/BOPAlgo_Builder_2.cxx b/src/BOPAlgo/BOPAlgo_Builder_2.cxx index c32a4a3019..ad7e36e70d 100644 --- a/src/BOPAlgo/BOPAlgo_Builder_2.cxx +++ b/src/BOPAlgo/BOPAlgo_Builder_2.cxx @@ -403,8 +403,10 @@ void BOPAlgo_Builder::BuildSplitFaces() aLE.Append(aSp); } // - BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane (aLE, aFF); - // + if (!myPaveFiller->NonDestructive()) { + // speed up for planar faces + BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane (aLE, aFF); + } // 3 Build split faces BOPAlgo_BuilderFace& aBF=aVBF.Append1(); aBF.SetFace(aF); diff --git a/src/BOPAlgo/BOPAlgo_CheckerSI.cdl b/src/BOPAlgo/BOPAlgo_CheckerSI.cdl index 9578c091f1..d7b6844952 100644 --- a/src/BOPAlgo/BOPAlgo_CheckerSI.cdl +++ b/src/BOPAlgo/BOPAlgo_CheckerSI.cdl @@ -48,20 +48,6 @@ is -- 4 - V/V, V/E, E/E, V/F and E/F; -- 5 - all interferences, default value. - SetNonDestructive(me:out; - theFlag: Boolean from Standard); - ---Purpose: Sets the flag that defines - -- the mode of the treatment: - -- the copy of the argument when theFlag is true - -- the argument itself when theFlag is false - - NonDestructive(me) - returns Boolean from Standard; - ---Purpose: Returns the flag that defines the - -- mode of the treatment: - -- true when the copy of the argument is used - -- false when the argument itself is used - PostTreat (me:out) is protected; ---Purpose: Provides post-treatment actions @@ -76,7 +62,6 @@ is fields myLevelOfCheck: Integer from Standard is protected; - myNonDestructive: Boolean from Standard is protected; myNewOldMap : DataMapOfShapeShape from BOPCol is protected; end CheckerSI; diff --git a/src/BOPAlgo/BOPAlgo_CheckerSI.cxx b/src/BOPAlgo/BOPAlgo_CheckerSI.cxx index b22be8b282..c2ab02bc8b 100644 --- a/src/BOPAlgo/BOPAlgo_CheckerSI.cxx +++ b/src/BOPAlgo/BOPAlgo_CheckerSI.cxx @@ -76,22 +76,6 @@ void BOPAlgo_CheckerSI::SetLevelOfCheck(const Standard_Integer theLevel) } } //======================================================================= -//function : SetNonDestructive -//purpose : -//======================================================================= -void BOPAlgo_CheckerSI::SetNonDestructive(const Standard_Boolean theFlag) -{ - myNonDestructive=theFlag; -} -//======================================================================= -//function : NonDestructive -//purpose : -//======================================================================= -Standard_Boolean BOPAlgo_CheckerSI::NonDestructive() const -{ - return myNonDestructive; -} -//======================================================================= //function : Init //purpose : //======================================================================= diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller.cdl b/src/BOPAlgo/BOPAlgo_PaveFiller.cdl index 7dd03af03e..9922eaafe5 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller.cdl +++ b/src/BOPAlgo/BOPAlgo_PaveFiller.cdl @@ -49,6 +49,7 @@ uses Iterator from BOPDS, PIterator from BOPDS, PaveBlock from BOPDS, + CommonBlock from BOPDS, Curve from BOPDS, IndexedDataMapOfShapeCoupleOfPaveBlocks from BOPDS, MapOfPaveBlock from BOPDS, @@ -483,6 +484,69 @@ is returns Real from Standard; ---Purpose: Returns the additional tolerance + UpdateVertex(me:out; + nV : Integer from Standard; + aTolNew: Real from Standard) + returns Integer from Standard + is protected; + ---Purpose: + -- Updates tolerance vertex nV due to V/E interference; + -- It always creates new vertex if nV is from arguments + -- Returns: DS index of updated vertex. + + ComputeTolerance(me:out; + theCB:CommonBlock from BOPDS) + returns Real from Standard + is protected; + + UpdatePaveBlocksWithSDVertices(me:out) + is protected; + + UpdateCommonBlocksWithSDVertices (me:out) + is protected; + + UpdateBlocksWithSharedVertices (me:out) + is protected; + + EstimatePaveOnCurve (me:out; + nV : Integer from Standard; + theNC : out Curve from BOPDS; + theTolR3D : Real from Standard) + returns Boolean from Standard + is protected; + + UpdateEdgeTolerance(me:out; + nE : Integer from Standard; + aTolNew: Real from Standard) + is protected; + + SetNonDestructive(me:out; + theFlag:Boolean from Standard); + ---Purpose: Sets the flag that defines + -- the mode of treatment: in non-destructive mode + -- the argument shapes are not modified: the copy of sub-shape + -- is created in the result if it is needed to be updated. + + SetNonDestructive(me:out) + is protected; + ---Purpose: Sets non-destructive mode automatically if the argument + -- contains a locked shape (see TopoDS_Shape::Locked()). + + NonDestructive(me) + returns Boolean from Standard; + ---Purpose: Returns the flag that defines + -- the mode of treatment: in non-destructive mode + -- the argument shapes are not modified: the copy of sub-shape + -- is created in the result if it is needed to be updated. + + SetIsPrimary(me:out; + theFlag:Boolean from Standard) + is protected; + + IsPrimary(me) + returns Boolean from Standard + is protected; + fields myArguments : ListOfShape from BOPCol is protected; myDS : PDS from BOPDS is protected; @@ -490,4 +554,6 @@ fields myContext : Context from IntTools is protected; mySectionAttribute : SectionAttribute from BOPAlgo is protected; myFuzzyValue : Real from Standard is protected; + myNonDestructive : Boolean from Standard is protected; + myIsPrimary : Boolean from Standard is protected; end PaveFiller; diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller.cxx index b5fe4c6110..9052f46fdc 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller.cxx @@ -39,6 +39,8 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller() { myDS=NULL; myIterator=NULL; + myNonDestructive=Standard_False; + myIsPrimary=Standard_True; } //======================================================================= //function : @@ -52,6 +54,8 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller { myDS=NULL; myIterator=NULL; + myNonDestructive=Standard_False; + myIsPrimary=Standard_True; } //======================================================================= //function : ~ @@ -62,6 +66,38 @@ BOPAlgo_PaveFiller::~BOPAlgo_PaveFiller() Clear(); } //======================================================================= +//function : SetNonDestructive +//purpose : +//======================================================================= +void BOPAlgo_PaveFiller::SetNonDestructive(const Standard_Boolean bFlag) +{ + myNonDestructive=bFlag; +} +//======================================================================= +//function : NonDestructive +//purpose : +//======================================================================= +Standard_Boolean BOPAlgo_PaveFiller::NonDestructive()const +{ + return myNonDestructive; +} +//======================================================================= +//function : SetIsPrimary +//purpose : +//======================================================================= +void BOPAlgo_PaveFiller::SetIsPrimary(const Standard_Boolean bFlag) +{ + myIsPrimary=bFlag; +} +//======================================================================= +//function : IsPrimary +//purpose : +//======================================================================= +Standard_Boolean BOPAlgo_PaveFiller::IsPrimary()const +{ + return myIsPrimary; +} +//======================================================================= //function : Clear //purpose : //======================================================================= @@ -171,6 +207,7 @@ void BOPAlgo_PaveFiller::Init() // // 0 Clear Clear(); + // // 1.myDS myDS=new BOPDS_DS(myAllocator); @@ -187,6 +224,9 @@ void BOPAlgo_PaveFiller::Init() // 3 myContext myContext=new IntTools_Context; // + // 4 NonDestructive flag + SetNonDestructive(); + // myErrorStatus=0; } //======================================================================= @@ -236,34 +276,42 @@ void BOPAlgo_PaveFiller::PerformInternal() return; } // + UpdatePaveBlocksWithSDVertices(); myDS->UpdatePaveBlocks(); // 11 PerformEE(); if (myErrorStatus) { return; } + UpdatePaveBlocksWithSDVertices(); // 02 PerformVF(); if (myErrorStatus) { return; } + UpdatePaveBlocksWithSDVertices(); // 12 PerformEF(); if (myErrorStatus) { return; } + UpdatePaveBlocksWithSDVertices(); // - MakeSplitEdges(); + // 22 + PerformFF(); if (myErrorStatus) { return; } // - // 22 - PerformFF(); + UpdateBlocksWithSharedVertices(); + // + MakeSplitEdges(); if (myErrorStatus) { return; } // + UpdatePaveBlocksWithSDVertices(); + // MakeBlocks(); if (myErrorStatus) { return; @@ -280,7 +328,6 @@ void BOPAlgo_PaveFiller::PerformInternal() if (myErrorStatus) { return; } - // // 03 PerformVZ(); if (myErrorStatus) { diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx index a5e5e179a8..984d71ab3d 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx @@ -24,17 +24,19 @@ #include #include +#include #include #include #include #include #include -#include + #include #include -#include +#include +#include //======================================================================= // function: PerformVV @@ -100,7 +102,7 @@ // BOPTools_AlgoTools::MakeVertex(aLV, aVn); // - // Appennd new vertex to the DS + // Append new vertex to the DS aSIn.SetShape(aVn); n=myDS->Append(aSIn); // @@ -129,6 +131,15 @@ } } // + BOPCol_DataMapIteratorOfDataMapOfIntegerInteger aItDMII; + // + BOPCol_DataMapOfIntegerInteger& aDMII=myDS->ShapesSD(); + aItDMII.Initialize(aDMII); + for (; aItDMII.More(); aItDMII.Next()) { + n1=aItDMII.Key(); + myDS->InitPaveBlocksForVertex(n1); + } + // //-----------------------------------------------------scope t aLV.Clear(); aMBlocks.Clear(); diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx new file mode 100644 index 0000000000..8d581d08af --- /dev/null +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx @@ -0,0 +1,230 @@ +// Created by: Peter KURNEV +// Copyright (c) 2010-2014 OPEN CASCADE SAS +// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, +// EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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 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 + +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : SetNonDestructive +//purpose : +//======================================================================= +void BOPAlgo_PaveFiller::SetNonDestructive() +{ + if (!myIsPrimary) { + return; + } + // + Standard_Boolean bFlag; + BOPCol_ListIteratorOfListOfShape aItLS; + // + bFlag=Standard_False; + aItLS.Initialize(myArguments); + for(; aItLS.More() && (!bFlag); aItLS.Next()) { + const TopoDS_Shape& aS=aItLS.Value(); + bFlag=aS.Locked(); + } + myNonDestructive=bFlag; +} +//======================================================================= +//function : UpdateEdgeTolerance +//purpose : +//======================================================================= +void BOPAlgo_PaveFiller::UpdateEdgeTolerance (const Standard_Integer nE, + const Standard_Real aTol) +{ + Standard_Boolean bIsNewShape, bHasShapeSD; + Standard_Integer nV, nVx; + Standard_Real aTolV; + BRep_Builder aBB; + BOPCol_ListIteratorOfListOfInteger aIt; + // + BOPDS_ShapeInfo& aSIE=myDS->ChangeShapeInfo(nE); + const BOPCol_ListOfInteger& aLI=aSIE.SubShapes(); + // + if (myNonDestructive) { + bIsNewShape=myDS->IsNewShape(nE); + if (!bIsNewShape) { + return; + } + // + aIt.Initialize(aLI); + for (; aIt.More(); aIt.Next()) { + nV = aIt.Value(); + bHasShapeSD=myDS->HasShapeSD(nV, nVx); + if (bHasShapeSD) { + continue; + } + bIsNewShape=myDS->IsNewShape(nV); + if (!bIsNewShape) { + return; + } + } + } + // + const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE); + aBB.UpdateEdge(aE, aTol); + Bnd_Box& aBoxE=aSIE.ChangeBox(); + BRepBndLib::Add(aE, aBoxE); + // + aIt.Initialize(aLI); + for (; aIt.More(); aIt.Next()) { + nV = aIt.Value(); + bHasShapeSD=myDS->HasShapeSD(nV, nVx); + if (bHasShapeSD) { + nV=nVx; + } + const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV); + aTolV = BRep_Tool::Tolerance(aV); + if (aTolV < aTol) { + aBB.UpdateVertex(aV, aTol); + BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nV); + Bnd_Box& aBoxV = aSIV.ChangeBox(); + BRepBndLib::Add(aV, aBoxV); + } + } +} +//======================================================================= +//function : UpdateVertex +//purpose : +//======================================================================= +Standard_Integer BOPAlgo_PaveFiller::UpdateVertex + (const Standard_Integer nV, + const Standard_Real aTolNew) +{ + Standard_Integer nVNew; + Standard_Real aTolV; + BRep_Builder aBB; + + nVNew = nV; + if (myDS->IsNewShape(nVNew) || + myDS->HasShapeSD(nV, nVNew) || + !myNonDestructive) { + // nV is a new vertex, it has SD or non-destructive mode is not in force + const TopoDS_Vertex& aVSD = *(TopoDS_Vertex*)&myDS->Shape(nVNew); + aTolV = BRep_Tool::Tolerance(aVSD); + if (aTolV < aTolNew) { + aBB.UpdateVertex(aVSD, aTolNew); + BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVNew); + Bnd_Box& aBoxV = aSIV.ChangeBox(); + BRepBndLib::Add(aVSD, aBoxV); + } + return nVNew; + } + // + // nV is old vertex + const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV); + aTolV = BRep_Tool::Tolerance(aV); + // + // create new vertex + TopoDS_Vertex aVNew; + gp_Pnt aPV = BRep_Tool::Pnt(aV); + aBB.MakeVertex(aVNew, aPV, Max(aTolV, aTolNew)); + // + // append new vertex to DS + BOPDS_ShapeInfo aSIV; + aSIV.SetShapeType(TopAbs_VERTEX); + aSIV.SetShape(aVNew); + nVNew = myDS->Append(aSIV); + // + // bounding box for the new vertex + BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(nVNew); + Bnd_Box& aBoxDS = aSIDS.ChangeBox(); + BRepBndLib::Add(aVNew, aBoxDS); + // + // add vertex to SD map + myDS->AddShapeSD(nV, nVNew); + // + myDS->InitPaveBlocksForVertex(nV); + // + return nVNew; +} +//======================================================================= +//function : UpdatePaveBlocksWithSDVertices +//purpose : +//======================================================================= +void BOPAlgo_PaveFiller::UpdatePaveBlocksWithSDVertices() +{ + if (!myNonDestructive) { + return; + } + myDS->UpdatePaveBlocksWithSDVertices(); +} +//======================================================================= +//function : UpdateCommonBlocksWithSDVertices +//purpose : +//======================================================================= +void BOPAlgo_PaveFiller::UpdateCommonBlocksWithSDVertices() +{ + if (!myNonDestructive) { + return; + } + Standard_Integer aNbPBP; + // + BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->ChangePaveBlocksPool(); + aNbPBP=aPBP.Extent(); + if(!aNbPBP) { + return; + } + // + Standard_Integer i, nV1, nV2; + Standard_Real aTolV; + BOPDS_MapOfCommonBlock aMCB; + BOPDS_ListIteratorOfListOfPaveBlock aItPB; + Handle(BOPDS_PaveBlock) aPB; + // + aTolV = Precision::Confusion(); + // + for (i=0; iCommonBlock(aPB); + if (aCB.IsNull()) { + continue; + } + // + if (aMCB.Add(aCB)) { + myDS->SortPaveBlocks(aCB); + aPB->Indices(nV1, nV2); + UpdateVertex(nV1, aTolV); + UpdateVertex(nV2, aTolV); + myDS->UpdateCommonBlockWithSDVertices(aCB); + } + } + } + UpdatePaveBlocksWithSDVertices(); +} diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx index 69cfa25e38..6dc2711881 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx @@ -45,7 +45,7 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo { BOPAlgo_VertexEdge() : BOPAlgo_Algo(), - myIV(-1), myIE(-1), myIVx(-1), myFlag(-1), myT(-1.) { + myIV(-1), myIE(-1), myIVx(-1), myFlag(-1), myT(-1.), myTolVNew(-1.) { }; // virtual ~BOPAlgo_VertexEdge(){ @@ -71,18 +71,10 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo { myV=aV; } // - const TopoDS_Vertex& Vertex()const { - return myV; - } - // void SetEdge(const TopoDS_Edge& aE) { myE=aE; } // - const TopoDS_Edge& Edge()const { - return myE; - } - // Standard_Integer Flag()const { return myFlag; } @@ -91,6 +83,10 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo { return myT; } // + Standard_Real VertexNewTolerance()const { + return myTolVNew; + } + // void SetContext(const Handle(IntTools_Context)& aContext) { myContext=aContext; } @@ -101,7 +97,7 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo { // virtual void Perform() { BOPAlgo_Algo::UserBreak(); - myFlag=myContext->ComputeVE (myV, myE, myT); + myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew); }; // protected: @@ -110,6 +106,7 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo { Standard_Integer myIVx; Standard_Integer myFlag; Standard_Real myT; + Standard_Real myTolVNew; TopoDS_Vertex myV; TopoDS_Edge myE; Handle(IntTools_Context) myContext; @@ -137,11 +134,10 @@ void BOPAlgo_PaveFiller::PerformVE() { Standard_Boolean bJustAdd; Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx, k, aNbVE; - Standard_Real aT, aTolE, aTolV; + Standard_Real aT; BOPDS_Pave aPave; BOPDS_PassKey aPK; BOPDS_MapOfPassKey aMPK; - BRep_Builder aBB; BOPAlgo_VectorOfVertexEdge aVVE; // myErrorStatus=0; @@ -208,29 +204,28 @@ void BOPAlgo_PaveFiller::PerformVE() if (!iFlag) { aVESolver.Indices(nV, nE, nVx); aT=aVESolver.Parameter(); - const TopoDS_Vertex& aV=aVESolver.Vertex(); - const TopoDS_Edge& aE=aVESolver.Edge(); // 1 BOPDS_InterfVE& aVE=aVEs.Append1(); aVE.SetIndices(nV, nE); aVE.SetParameter(aT); // 2 myDS->AddInterf(nV, nE); - // 3 + // + // BOPDS_ListOfPaveBlock& aLPB=myDS->ChangePaveBlocks(nE); Handle(BOPDS_PaveBlock)& aPB=*((Handle(BOPDS_PaveBlock)*)&aLPB.First()); // + // 3 update vertex V/E if necessary + Standard_Real aTolVNew = aVESolver.VertexNewTolerance(); + nVx=UpdateVertex(nV, aTolVNew); + //4 + if (myDS->IsNewShape(nVx)) { + aVE.SetIndexNew(nVx); + } + //5 append ext pave to pave block aPave.SetIndex(nVx); aPave.SetParameter(aT); aPB->AppendExtPave(aPave); - aTolV = BRep_Tool::Tolerance(aV); - aTolE = BRep_Tool::Tolerance(aE); - if ( aTolV < aTolE) { - aBB.UpdateVertex(aV, aTolE); - BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVx); - Bnd_Box& aBoxDS=aSIDS.ChangeBox(); - BRepBndLib::Add(aV, aBoxDS); } - } }//for (k=0; k < aNbVE; ++k) { } diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx index 24d5ec8f19..cd3f3be38c 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx @@ -569,7 +569,7 @@ void BOPAlgo_PaveFiller::PerformEE() aMPBToUpdate.Clear(); } //======================================================================= -//function : PerformVertices +//function : PerformVerticesEE //purpose : //======================================================================= Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE @@ -890,8 +890,8 @@ void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV, Handle(BOPDS_PaveBlock)& aPB, BOPDS_MapOfPaveBlock& aMPBToUpdate) { - Standard_Integer aNbPnt, nE; - gp_Pnt aP; + Standard_Integer nE, nVx, nVSD, iFlag; + Standard_Real aT, aTolVNew; // nE = aPB->OriginalEdge(); // @@ -908,60 +908,44 @@ void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV, return; } // - if (aPB->Pave1().Index() == nV || aPB->Pave2().Index() == nV) { + if (aPB->Pave1().Index() == nV || + aPB->Pave2().Index() == nV) { return; } // - const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV); - const TopoDS_Edge& aE = *(TopoDS_Edge*) &myDS->Shape(nE); - aP=BRep_Tool::Pnt(aV); + nVx = nV; + if (myDS->HasShapeSD(nV, nVSD)) { + nVx = nVSD; + } // - GeomAPI_ProjectPointOnCurve& aProjector=myContext->ProjPC(aE); - aProjector.Perform(aP); + const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nVx); + const TopoDS_Edge& aE = *(TopoDS_Edge*) &myDS->Shape(nE); // - aNbPnt = aProjector.NbPoints(); - if (aNbPnt) { - Standard_Real aT, aDist; - //Standard_Integer i; - BRep_Builder aBB; + iFlag = myContext->ComputeVE(aV, aE, aT, aTolVNew); + if (iFlag == 0 || iFlag == -4) { BOPDS_Pave aPave; // - aDist=aProjector.LowerDistance(); - aT=aProjector.LowerDistanceParameter(); // BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE(); aVEs.SetIncrement(10); + // 1 BOPDS_InterfVE& aVE=aVEs.Append1(); aVE.SetIndices(nV, nE); aVE.SetParameter(aT); - // + // 2 myDS->AddInterf(nV, nE); // - aBB.UpdateVertex(aV, aDist); - BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV); - Bnd_Box& aBox=aSIDS.ChangeBox(); - BRepBndLib::Add(aV, aBox); - // - aPave.SetIndex(nV); + // 3 update vertex V/E if necessary + nVx=UpdateVertex(nV, aTolVNew); + // 4 + if (myDS->IsNewShape(nVx)) { + aVE.SetIndexNew(nVx); + } + // 5 append ext pave to pave block + aPave.SetIndex(nVx); aPave.SetParameter(aT); aPB->AppendExtPave(aPave); // aMPBToUpdate.Add(aPB); } } - - /* - // DEBf - { - TopoDS_Compound aCx; - BRep_Builder aBBx; - aBBx.MakeCompound(aCx); - aItMVCPB.Initialize(theMVCPB); - for (; aItMVCPB.More(); aItMVCPB.Next()) { - const TopoDS_Shape& aS=aItMVCPB.Key(); - aBBx.Add(aCx, aS); - } - BRepTools::Write(aCx, "cx"); - } - // DEBt - */ diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx index 65d6f55f29..43b0997b46 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx @@ -20,8 +20,6 @@ #include #include #include -#include -#include // #include #include @@ -47,7 +45,7 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo { BOPAlgo_VertexFace() : BOPAlgo_Algo(), myIV(-1), myIF(-1), myIVx(-1), - myFlag(-1), myT1(-1.), myT2(-1.) { + myFlag(-1), myT1(-1.), myT2(-1.), myTolVNew(-1.) { } // virtual ~BOPAlgo_VertexFace(){ @@ -95,6 +93,10 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo { aT2=myT2; } // + Standard_Real VertexNewTolerance()const { + return myTolVNew; + } + // void SetContext(const Handle(IntTools_Context)& aContext) { myContext=aContext; } @@ -105,7 +107,7 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo { // virtual void Perform() { BOPAlgo_Algo::UserBreak(); - myFlag=myContext->ComputeVF(myV, myF, myT1, myT2); + myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew); } // protected: @@ -115,6 +117,7 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo { Standard_Integer myFlag; Standard_Real myT1; Standard_Real myT2; + Standard_Real myTolVNew; TopoDS_Vertex myV; TopoDS_Face myF; Handle(IntTools_Context) myContext; @@ -142,8 +145,7 @@ void BOPAlgo_PaveFiller::PerformVF() { Standard_Boolean bJustAdd; Standard_Integer iSize, nV, nF, nVSD, iFlag, nVx, aNbVF, k; - Standard_Real aT1, aT2, aTolF, aTolV; - BRep_Builder aBB; + Standard_Real aT1, aT2; BOPAlgo_VectorOfVertexFace aVVF; // myErrorStatus=0; @@ -207,27 +209,25 @@ void BOPAlgo_PaveFiller::PerformVF() // aVertexFace.Indices(nV, nF, nVx); aVertexFace.Parameters(aT1, aT2); - const TopoDS_Vertex& aV=aVertexFace.Vertex(); - const TopoDS_Face& aF=aVertexFace.Face(); // 1 BOPDS_InterfVF& aVF=aVFs.Append1(); aVF.SetIndices(nVx, nF); aVF.SetUV(aT1, aT2); // 2 myDS->AddInterf(nVx, nF); - // 3 + // + // 3 update vertex V/F if necessary + Standard_Real aTolVNew = aVertexFace.VertexNewTolerance(); + nVx=UpdateVertex(nVx, aTolVNew); + // + // 4 + if (myDS->IsNewShape(nVx)) { + aVF.SetIndexNew(nVx); + } + // 5 update FaceInfo BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF); BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn(); aMVIn.Add(nVx); - // 4 - aTolV = BRep_Tool::Tolerance(aV); - aTolF = BRep_Tool::Tolerance(aF); - if (aTolV < aTolF) { - aBB.UpdateVertex(aV, aTolF); - BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVx); - Bnd_Box& aBoxV = aSIV.ChangeBox(); - BRepBndLib::Add(aV, aBoxV); - } }//for (k=0; k < aNbVF; ++k) { }// if (iSize) { else { diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx index 18bf7ba3b4..41019ebc57 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx @@ -19,6 +19,8 @@ #include // +#include + #include // #include @@ -311,12 +313,25 @@ void BOPAlgo_PaveFiller::PerformEF() if (bIsOnPave[j]) { bV[j]=CheckFacePaves(nV[j], aMIFOn, aMIFIn); if (bV[j]) { - const TopoDS_Vertex& aV= + const TopoDS_Vertex& aV = (*(TopoDS_Vertex *)(&myDS->Shape(nV[j]))); - BOPTools_AlgoTools::UpdateVertex(aE, aT, aV); - BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV[j]); - Bnd_Box& aBoxDS=aSIDS.ChangeBox(); - BRepBndLib::Add(aV, aBoxDS); + // + Standard_Real f, l, aTolVnew, aDistPP, aTolPC, aTolV; + // + const Handle(Geom_Curve)& aCur = BRep_Tool::Curve(aE, f, l); + // + gp_Pnt aP1 = BRep_Tool::Pnt(aV); + gp_Pnt aP2 = aCur->Value(aT); + // + + aDistPP=aP1.Distance(aP2); + + aTolPC=Precision::PConfusion(); + aTolV=BRep_Tool::Tolerance(aV); + if (aDistPP > (aTolV+aTolPC)) { + aTolVnew=Max(aTolE, aDistPP); + UpdateVertex(nV[j], aTolVnew); + } } else { bIsOnPave[j] = ForceInterfVF(nV[j], nF); @@ -370,11 +385,6 @@ void BOPAlgo_PaveFiller::PerformEF() myDS->AddInterf(nE, nF); break; } - //update tolerance of edge if needed - if (aTolE < aTolF) { - myDS->UpdateEdgeTolerance(nE, aTolF); - aTolE = aTolF; - } aEF.SetCommonPart(aCPart); // 2 myDS->AddInterf(nE, nF); @@ -451,6 +461,8 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF } // // 2 Fuse vertices + aPF.SetIsPrimary(Standard_False); + aPF.SetNonDestructive(myNonDestructive); aPF.SetArguments(aLS); aPF.Perform(); iErr=aPF.ErrorStatus(); @@ -530,7 +542,7 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF } } } - // 6 Split PaveBlocksa + // 6 Split PaveBlocks for (i=1; i<=aNbPBLI; ++i) { Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i); nE=aPB->OriginalEdge(); @@ -615,46 +627,37 @@ Standard_Boolean BOPAlgo_PaveFiller::ForceInterfVF const Standard_Integer nF) { Standard_Boolean bRet; + Standard_Integer iFlag, nVx; + Standard_Real U, V, aTolVNew; // bRet = Standard_False; const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV); const TopoDS_Face& aF = *(TopoDS_Face*) &myDS->Shape(nF); // - GeomAPI_ProjectPointOnSurf& aProj = myContext->ProjPS(aF); - const gp_Pnt& aP = BRep_Tool::Pnt(aV); - aProj.Perform(aP); - if (!aProj.IsDone()) { - return bRet; - } - Standard_Real aDist, U, V; - // - aDist=aProj.LowerDistance(); - aProj.LowerDistanceParameters(U, V); - // - gp_Pnt2d aP2d(U, V); - bRet = myContext->IsPointInFace (aF, aP2d); - if (bRet) { - //Standard_Integer i; - BRep_Builder aBB; + iFlag = myContext->ComputeVF(aV, aF, U, V, aTolVNew); + if (iFlag == 0 || iFlag == -2) { + bRet=!bRet; // BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF(); aVFs.SetIncrement(10); + // 1 BOPDS_InterfVF& aVF=aVFs.Append1(); + // aVF.SetIndices(nV, nF); aVF.SetUV(U, V); - // + // 2 myDS->AddInterf(nV, nF); // - aBB.UpdateVertex(aV, aDist); - BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV); - Bnd_Box& aBoxDS=aSIDS.ChangeBox(); - BRepBndLib::Add(aV, aBoxDS); + // 3 update vertex V/F if necessary + nVx=UpdateVertex(nV, aTolVNew); + // 4 + if (myDS->IsNewShape(nVx)) { + aVF.SetIndexNew(nVx); + } // BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF); BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn(); - aMVIn.Add(nV); + aMVIn.Add(nVx); } - // return bRet; } - diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx index eceef1604b..317793d2ad 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx @@ -217,22 +217,21 @@ void BOPAlgo_PaveFiller::PerformFF() const TopoDS_Face& aF1=(*(TopoDS_Face *)(&myDS->Shape(nF1))); const TopoDS_Face& aF2=(*(TopoDS_Face *)(&myDS->Shape(nF2))); // + if (aMI.Add(nF1)) { + myDS->UpdateFaceInfoOn(nF1); + myDS->UpdateFaceInfoIn(nF1); + } + if (aMI.Add(nF2)) { + myDS->UpdateFaceInfoOn(nF2); + myDS->UpdateFaceInfoIn(nF2); + } + // aBAS1.Initialize(aF1, Standard_False); aBAS2.Initialize(aF2, Standard_False); - // if (aBAS1.GetType() == GeomAbs_Plane && aBAS2.GetType() == GeomAbs_Plane) { Standard_Boolean bToIntersect; // - if (aMI.Add(nF1)) { - myDS->UpdateFaceInfoOn(nF1); - myDS->UpdateFaceInfoIn(nF1); - } - if (aMI.Add(nF2)) { - myDS->UpdateFaceInfoOn(nF2); - myDS->UpdateFaceInfoIn(nF2); - } - // bToIntersect = CheckPlanes(nF1, nF2); if (!bToIntersect) { myDS->AddInterf(nF1, nF2); @@ -526,10 +525,11 @@ void BOPAlgo_PaveFiller::MakeBlocks() const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE); aTolE = BRep_Tool::Tolerance(aE); if (aTolR3D > aTolE) { - myDS->UpdateEdgeTolerance(nE, aTolR3D); + UpdateEdgeTolerance(nE, aTolR3D); } bInBothFaces = Standard_False; - } else { + } + else { bInBothFaces = (aFI1.PaveBlocksOn().Contains(aPBOut) || aFI1.PaveBlocksIn().Contains(aPBOut))&& (aFI2.PaveBlocksOn().Contains(aPBOut) || @@ -644,6 +644,8 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF // BOPCol_ListOfShape aLS(theAllocator); BOPAlgo_PaveFiller aPF(theAllocator); + aPF.SetIsPrimary(Standard_False); + aPF.SetNonDestructive(myNonDestructive); // BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF(); // @@ -1036,10 +1038,10 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo //function : IsExistingVertex //purpose : //======================================================================= - Standard_Boolean BOPAlgo_PaveFiller::IsExistingVertex - (const gp_Pnt& aP, - const Standard_Real theTolR3D, - const BOPCol_MapOfInteger& aMVOnIn)const +Standard_Boolean BOPAlgo_PaveFiller::IsExistingVertex + (const gp_Pnt& aP, + const Standard_Real theTolR3D, + const BOPCol_MapOfInteger& aMVOnIn)const { Standard_Boolean bRet; Standard_Integer nV, iFlag; @@ -1077,11 +1079,11 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo //function : IsExistingPaveBlock //purpose : //======================================================================= - Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock - (const Handle(BOPDS_PaveBlock)& thePB, - const BOPDS_Curve& theNC, - const Standard_Real theTolR3D, - const BOPCol_ListOfInteger& theLSE) +Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock + (const Handle(BOPDS_PaveBlock)& thePB, + const BOPDS_Curve& theNC, + const Standard_Real theTolR3D, + const BOPCol_ListOfInteger& theLSE) { Standard_Boolean bRet=Standard_True; // @@ -1104,6 +1106,8 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo aItLI.Initialize(theLSE); for (; aItLI.More(); aItLI.Next()) { nE=aItLI.Value(); + if (nE < 0) + continue; const BOPDS_ShapeInfo& aSIE=myDS->ChangeShapeInfo(nE); const Bnd_Box& aBoxE=aSIE.Box(); if (!aBoxE.IsOut(aBoxPm)) { @@ -1160,6 +1164,8 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo const Handle(BOPDS_PaveBlock)& aPB = theMPBOnIn(i); aPB->Indices(nV21, nV22); nSp=aPB->Edge(); + if (nSp < 0) + continue; const BOPDS_ShapeInfo& aSISp=myDS->ChangeShapeInfo(nSp); const TopoDS_Edge& aSp=(*(TopoDS_Edge *)(&aSISp.Shape())); const Bnd_Box& aBoxSp=aSISp.Box(); @@ -1419,9 +1425,10 @@ Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance //function : GetEFPnts //purpose : //======================================================================= - void BOPAlgo_PaveFiller::GetEFPnts(const Standard_Integer nF1, - const Standard_Integer nF2, - IntSurf_ListOfPntOn2S& aListOfPnts) +void BOPAlgo_PaveFiller::GetEFPnts + (const Standard_Integer nF1, + const Standard_Integer nF2, + IntSurf_ListOfPntOn2S& aListOfPnts) { Standard_Integer nE, nF, nFOpposite, aNbEFs, i; Standard_Real U1, U2, V1, V2, f, l; @@ -1626,11 +1633,11 @@ Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance //function : GetStickVertices //purpose : //======================================================================= - void BOPAlgo_PaveFiller::GetStickVertices(const Standard_Integer nF1, - const Standard_Integer nF2, - BOPCol_MapOfInteger& aMVStick, - BOPCol_MapOfInteger& aMVEF, - BOPCol_MapOfInteger& aMI) +void BOPAlgo_PaveFiller::GetStickVertices(const Standard_Integer nF1, + const Standard_Integer nF2, + BOPCol_MapOfInteger& aMVStick, + BOPCol_MapOfInteger& aMVEF, + BOPCol_MapOfInteger& aMI) { Standard_Integer nS1, nS2, nVNew, aTypeInt, i; // @@ -1808,7 +1815,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC, //function : ProcessOldPaveBlocks //purpose : //======================================================================= - void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks +void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks (const Standard_Integer theInt, const BOPDS_IndexedMapOfPaveBlock& aMPBOnIn, const BOPCol_DataMapOfIntegerListOfInteger& aDMBV, @@ -1882,11 +1889,11 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC, //function : UpdateExistingPaveBlocks //purpose : //======================================================================= - void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks - (const Handle(BOPDS_PaveBlock)& aPBf, - BOPDS_ListOfPaveBlock& aLPB, - const Standard_Integer nF1, - const Standard_Integer nF2) +void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks + (const Handle(BOPDS_PaveBlock)& aPBf, + BOPDS_ListOfPaveBlock& aLPB, + const Standard_Integer nF1, + const Standard_Integer nF2) { Standard_Integer nE; Standard_Boolean bCB; @@ -2044,7 +2051,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC, // function: PutClosingPaveOnCurve // purpose: //======================================================================= - void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC) +void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC) { Standard_Boolean bIsClosed, bHasBounds, bAdded; Standard_Integer nVC, j; @@ -2099,7 +2106,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC, //function : PreparePostTreatFF //purpose : //======================================================================= - void BOPAlgo_PaveFiller::PreparePostTreatFF +void BOPAlgo_PaveFiller::PreparePostTreatFF (const Standard_Integer aInt, const Standard_Integer aCur, const Handle(BOPDS_PaveBlock)& aPB, @@ -2265,3 +2272,120 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks aTolFF = Max(aTolFF, 5.e-6); } } +//======================================================================= +//function : UpdateBlocksWithSharedVertices +//purpose : +//======================================================================= +void BOPAlgo_PaveFiller::UpdateBlocksWithSharedVertices() +{ + if (!myNonDestructive) { + return; + } + // + myErrorStatus=0; + // + Standard_Integer aNbFF; + // + BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF(); + aNbFF=aFFs.Extent(); + if (!aNbFF) { + return; + } + // + Standard_Boolean bOnCurve, bHasShapeSD; + Standard_Integer i, nF1, nF2, aNbC, j, nV, nVSD; + Standard_Real aTolR3D, aTolV; + BOPCol_MapOfInteger aMF; + // + for (i=0; iUpdateFaceInfoOn(nF1); + } + if (aMF.Add(nF2)) { + myDS->UpdateFaceInfoOn(nF2); + } + // + // Collect old vertices that are shared for nF1, nF2 ->aMI; + BOPCol_MapOfInteger aMI; + BOPCol_MapIteratorOfMapOfInteger aItMI; + // + BOPDS_FaceInfo& aFI1=myDS->ChangeFaceInfo(nF1); + BOPDS_FaceInfo& aFI2=myDS->ChangeFaceInfo(nF2); + // + const BOPCol_MapOfInteger& aMVOn1=aFI1.VerticesOn(); + const BOPCol_MapOfInteger& aMVIn1=aFI1.VerticesIn(); + const BOPCol_MapOfInteger& aMVOn2=aFI2.VerticesOn(); + const BOPCol_MapOfInteger& aMVIn2=aFI2.VerticesIn(); + // + for (j=0; j<2; ++j) { + const BOPCol_MapOfInteger& aMV1=(!j) ? aMVOn1 : aMVIn1; + aItMI.Initialize(aMV1); + for (; aItMI.More(); aItMI.Next()) { + nV=aItMI.Value(); + if (myDS->IsNewShape(nV)) { + continue; + } + if (aMVOn2.Contains(nV) || aMVIn2.Contains(nV)) { + aMI.Add(nV); + } + } + } + // + // Try to put vertices aMI on curves + for (j=0; jHasShapeSD(nV, nVSD); + if (bHasShapeSD) { + continue; + } + // + bOnCurve=EstimatePaveOnCurve(nV, aNC, aTolR3D); + if (!bOnCurve) { + continue; + } + // + const TopoDS_Vertex& aV=*((TopoDS_Vertex *)&myDS->Shape(nV)); + aTolV=BRep_Tool::Tolerance(aV); + // + UpdateVertex(nV, aTolV); + } + }//for (j=0; jShape(nV)); + const IntTools_Curve& aIC=aNC.Curve(); + // + bIsVertexOnLine=myContext->IsVertexOnLine(aV, aIC, aTolR3D, aT); + return bIsVertexOnLine; +} diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx index 29364f4680..1d5c773139 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx @@ -57,6 +57,8 @@ #include #include #include +#include +#include #include #include @@ -359,13 +361,17 @@ void BOPAlgo_PaveFiller::MakeSplitEdges() Standard_Boolean bCB, bV1, bV2; Standard_Integer i, nE, nV1, nV2, nSp, aNbPB, aNbVBSE, k; Standard_Real aT1, aT2; - BOPDS_ListIteratorOfListOfPaveBlock aItPB, aItPBCB; + BOPDS_ListIteratorOfListOfPaveBlock aItPB; Handle(BOPDS_PaveBlock) aPB; BOPDS_MapOfPaveBlock aMPB(100); TopoDS_Vertex aV1, aV2; TopoDS_Edge aE; BOPAlgo_VectorOfSplitEdge aVBSE; + // + UpdateCommonBlocksWithSDVertices(); + // + aNbPBP=aPBP.Extent(); // for (i=0; iIndices(nV1, nV2); bV1=myDS->IsNewShape(nV1); bV2=myDS->IsNewShape(nV2); + bCB=myDS->IsCommonBlock(aPB); // - if (!(bV1 || bV2)) { - nE=aPB->OriginalEdge(); - aPB->SetEdge(nE); - continue; + if (!(bV1 || bV2)) { // no new vertices here + if (!myNonDestructive || (myNonDestructive && !bCB)) { + nE=aPB->OriginalEdge(); + aPB->SetEdge(nE); + continue; + } } } // aItPB.Initialize(aLPB); for (; aItPB.More(); aItPB.Next()) { aPB=aItPB.Value(); + nE=aPB->OriginalEdge(); + const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE); + if (aSIE.HasFlag()){ + continue; + } + // const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB); bCB=!aCB.IsNull(); if (bCB) { @@ -444,6 +459,8 @@ void BOPAlgo_PaveFiller::MakeSplitEdges() nSp=myDS->Append(aSI); // if (!aCBk.IsNull()) { + Standard_Real aTolCB = ComputeTolerance(aCBk); + myDS->UpdateEdgeTolerance(nSp, aTolCB); aCBk->SetEdge(nSp); } else { @@ -452,6 +469,52 @@ void BOPAlgo_PaveFiller::MakeSplitEdges() } } //======================================================================= +//function : ComputeTolerance +//purpose : +//======================================================================= +Standard_Real BOPAlgo_PaveFiller::ComputeTolerance + (const Handle(BOPDS_CommonBlock)& theCB) +{ + Standard_Integer nE, nF; + Standard_Real aTol, aTolMax; + BOPDS_ListIteratorOfListOfPaveBlock aItPB; + BOPCol_ListIteratorOfListOfInteger aItLI; + // + const Handle(BOPDS_PaveBlock)& aPBR = theCB->PaveBlock1(); + nE = aPBR->OriginalEdge(); + const TopoDS_Edge& aEOr = *(TopoDS_Edge*)&myDS->Shape(nE); + aTolMax = BRep_Tool::Tolerance(aEOr); + // + const BOPDS_ListOfPaveBlock& aLPB = theCB->PaveBlocks(); + aItPB.Initialize(aLPB); + for (; aItPB.More(); aItPB.Next()) { + const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value(); + if (aPB == aPBR) { + continue; + } + // + nE = aPB->OriginalEdge(); + const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE); + aTol = BRep_Tool::Tolerance(aE); + if (aTol > aTolMax) { + aTolMax=aTol; + } + } + // + const BOPCol_ListOfInteger& aLFI = theCB->Faces(); + aItLI.Initialize(aLFI); + for (; aItLI.More(); aItLI.Next()) { + nF = aItLI.Value(); + const TopoDS_Face& aF = *(TopoDS_Face*)&myDS->Shape(nF); + // + aTol=BRep_Tool::Tolerance(aF); + if (aTol > aTolMax) { + aTolMax=aTol; + } + } + return aTolMax; +} +//======================================================================= // function: SplitEdge // purpose: //======================================================================= @@ -732,6 +795,10 @@ void UpdateVertices(const TopoDS_Edge& aE, //======================================================================= void BOPAlgo_PaveFiller::Prepare() { + if (myNonDestructive) { + // do not allow storing pcurves in original edges if non-destructive mode is on + return; + } TopAbs_ShapeEnum aType[] = { TopAbs_VERTEX, TopAbs_EDGE, diff --git a/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx b/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx index eca9276911..e7ecdc8cde 100644 --- a/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx +++ b/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx @@ -170,8 +170,6 @@ void BOPAlgo_WireSplitter::SplitBlock(const TopoDS_Face& myFace, const BOPCol_ListOfShape& myEdges=aCB.Shapes(); // // 1.Filling mySmartMap - BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane(myEdges, myFace); - // aIt.Initialize(myEdges); for(; aIt.More(); aIt.Next()) { const TopoDS_Edge& aE=(*(TopoDS_Edge *)&aIt.Value()); diff --git a/src/BOPAlgo/FILES b/src/BOPAlgo/FILES index e6c81f7ad7..369b62468a 100644 --- a/src/BOPAlgo/FILES +++ b/src/BOPAlgo/FILES @@ -14,5 +14,4 @@ BOPAlgo_Builder_3.cxx BOPAlgo_Builder_4.cxx BOPAlgo_WireSplitter_1.cxx BOPAlgo_ListOfCheckResult.hxx - - +BOPAlgo_PaveFiller_11.cxx diff --git a/src/BOPDS/BOPDS_DS.cdl b/src/BOPDS/BOPDS_DS.cdl index 4fc375f386..9a3da4e313 100644 --- a/src/BOPDS/BOPDS_DS.cdl +++ b/src/BOPDS/BOPDS_DS.cdl @@ -44,6 +44,7 @@ uses ListOfInteger from BOPCol, MapOfInteger from BOPCol, BaseAllocator from BOPCol, + DataMapOfIntegerListOfInteger from BOPCol, -- ShapeInfo from BOPDS, IndexRange from BOPDS, @@ -627,7 +628,17 @@ is ---Purpose: --- Updates tolerance of the sub-shapes of the shape with index . --- - + UpdatePaveBlocksWithSDVertices(me:out); + + UpdatePaveBlockWithSDVertices(me:out; + thePB:PaveBlock from BOPDS); + + UpdateCommonBlockWithSDVertices(me:out; + theCB:CommonBlock from BOPDS); + + InitPaveBlocksForVertex(me:out; + theNV:Integer from Standard); + BuildBndBoxSolid (me:out; theIndex:Integer from Standard; theBox:out Box from Bnd) @@ -666,6 +677,8 @@ fields --same domain shapes myShapesSD : DataMapOfIntegerInteger from BOPCol is protected; -- + myMapVE: DataMapOfIntegerListOfInteger from BOPCol is protected; + -- --interferences myInterfTB : MapOfPassKey from BOPDS is protected; myInterfVV : VectorOfInterfVV from BOPDS is protected; diff --git a/src/BOPDS/BOPDS_DS.cxx b/src/BOPDS/BOPDS_DS.cxx index 371565cb71..5190db5162 100644 --- a/src/BOPDS/BOPDS_DS.cxx +++ b/src/BOPDS/BOPDS_DS.cxx @@ -54,19 +54,17 @@ #include #include #include +#include +#include #include // -static - inline void ResetShape(const TopoDS_Shape& aS); - -static - inline void ResetShapes(const TopoDS_Shape& aS); static void TotalShapes(const TopoDS_Shape& aS, - Standard_Integer& aNbS); + Standard_Integer& aNbS, + BOPCol_MapOfShape& aMS); static Standard_Real ComputeParameter(const TopoDS_Vertex& aV, @@ -97,6 +95,7 @@ BOPDS_DS::BOPDS_DS() myMapPBCB(100, myAllocator), myFaceInfoPool(0, myAllocator), myShapesSD(100, myAllocator), + myMapVE(100, myAllocator), myInterfTB(100, myAllocator), myInterfVV(0, myAllocator), myInterfVE(0, myAllocator), @@ -129,6 +128,7 @@ BOPDS_DS::BOPDS_DS(const Handle(NCollection_BaseAllocator)& theAllocator) myMapPBCB(100, myAllocator), myFaceInfoPool(0, myAllocator), myShapesSD(100, myAllocator), + myMapVE(100, myAllocator), myInterfTB(100, myAllocator), myInterfVV(0, myAllocator), myInterfVE(0, myAllocator), @@ -171,6 +171,7 @@ void BOPDS_DS::Clear() myPaveBlocksPool.Clear(); myFaceInfoPool.Clear(); myShapesSD.Clear(); + myMapVE.Clear(); myMapPBCB.Clear(); myInterfTB.Clear(); myInterfVV.Clear(); @@ -338,7 +339,6 @@ Standard_Integer BOPDS_DS::Index(const TopoDS_Shape& theS)const } return iRet; } - //======================================================================= //function : Init //purpose : @@ -354,6 +354,7 @@ void BOPDS_DS::Init() BOPCol_ListIteratorOfListOfShape aIt; BOPDS_IndexRange aR; Handle(NCollection_BaseAllocator) aAllocator; + BOPCol_MapOfShape aMS; // // 1 Append Source Shapes aNb=myArguments.Extent(); @@ -363,21 +364,17 @@ void BOPDS_DS::Init() // myRanges.SetIncrement(aNb); // - aIt.Initialize(myArguments); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aSx=aIt.Value(); - ResetShapes(aSx); - } - // aNbS=0; aIt.Initialize(myArguments); for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aSx=aIt.Value(); // aNbSx=0; - TotalShapes(aSx, aNbSx); + TotalShapes(aSx, aNbSx, aMS); + // aNbS=aNbS+aNbSx; } + aMS.Clear(); // myLines.SetIncrement(2*aNbS); //-----------------------------------------------------scope_1 f @@ -415,7 +412,6 @@ void BOPDS_DS::Init() BOPDS_ShapeInfo& aSI=ChangeShapeInfo(j); // const TopoDS_Shape& aS=aSI.Shape(); - ResetShape(aS); // aTS=aSI.ShapeType(); // @@ -427,7 +423,7 @@ void BOPDS_DS::Init() const Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*)&aV.TShape()); aTol = TV->Tolerance(); - // + // TODO: non-destructive myToleranceMap.Bind(j, aTol); aTol += aFuzz; TV->Tolerance(aTol); @@ -449,7 +445,7 @@ void BOPDS_DS::Init() const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*)&aE.TShape()); aTol = TE->Tolerance(); - // + // TODO: non-destructive myToleranceMap.Bind(j, aTol); aTol += aFuzz; TE->Tolerance(aTol); @@ -533,7 +529,7 @@ void BOPDS_DS::Init() const Handle(BRep_TFace)& TF = *((Handle(BRep_TFace)*)&aF.TShape()); aTol = TF->Tolerance(); - // + // TODO: non-destructive myToleranceMap.Bind(j, aTol); aTol += aFuzz; TF->Tolerance(aTol); @@ -647,6 +643,54 @@ void BOPDS_DS::Init() }//for (j=0; jChecked()) { + if (aMS.Add(aS)) { TopoDS_Iterator aIt; - // - pS->Checked(1); ++aNbS; aIt.Initialize(aS); for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aSx=aIt.Value(); - TotalShapes(aSx, aNbS); + TotalShapes(aSx, aNbS, aMS); } } } -//======================================================================= -//function : ResetShape -//purpose : -//======================================================================= -void ResetShape(const TopoDS_Shape& aS) -{ - TopoDS_Shape *pS; - // - pS=(TopoDS_Shape *)&aS; - pS->Checked(0); -} -//======================================================================= -//function : ResetShape -//purpose : -//======================================================================= -void ResetShapes(const TopoDS_Shape& aS) -{ - TopoDS_Iterator aIt; - // - ResetShape(aS); - aIt.Initialize(aS); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aSx=aIt.Value(); - ResetShape(aSx); - } -} + //======================================================================= //function : ComputeParameter //purpose : @@ -2283,3 +2299,84 @@ void CollectEdges(const BOPDS_DS& theDS, } } } + +//======================================================================= +//function : UpdatePaveBlocksWithSDVertices +//purpose : +//======================================================================= +void BOPDS_DS::UpdatePaveBlocksWithSDVertices() +{ + Standard_Integer i, aNbPBP; + BOPDS_ListIteratorOfListOfPaveBlock aItPB; + // + BOPDS_VectorOfListOfPaveBlock& aPBP=myPaveBlocksPool; + // + aNbPBP=aPBP.Size(); + for (i = 0; i < aNbPBP; ++i) { + BOPDS_ListOfPaveBlock& aLPB = aPBP(i); + // + aItPB.Initialize(aLPB); + for (; aItPB.More(); aItPB.Next()) { + Handle(BOPDS_PaveBlock)& aPB = aItPB.ChangeValue(); + UpdatePaveBlockWithSDVertices(aPB); + }// for (; aItPB.More(); aItPB.Next()) { + }// for (i = 0; i < aNbPBP; ++i) { +} +//======================================================================= +//function : UpdatePaveBlockWithSDVertices +//purpose : +//======================================================================= +void BOPDS_DS::UpdatePaveBlockWithSDVertices + (const Handle(BOPDS_PaveBlock)& thePB) +{ + Standard_Integer nV1, nV2; + BOPDS_Pave aPave1, aPave2; + // + aPave1 = thePB->Pave1(); + aPave2 = thePB->Pave2(); + // + nV1 = aPave1.Index(); + nV2 = aPave2.Index(); + // + if (HasShapeSD(nV1, nV1)) { + aPave1.SetIndex(nV1); + thePB->SetPave1(aPave1); + } + // + if (HasShapeSD(nV2, nV2)) { + aPave2.SetIndex(nV2); + thePB->SetPave2(aPave2); + } +} +//======================================================================= +//function : UpdateCommonBlockWithSDVertices +//purpose : +//======================================================================= +void BOPDS_DS::UpdateCommonBlockWithSDVertices + (const Handle(BOPDS_CommonBlock)& theCB) +{ + const BOPDS_ListOfPaveBlock& aLPB = theCB->PaveBlocks(); + BOPDS_ListIteratorOfListOfPaveBlock aItPB(aLPB); + for (; aItPB.More(); aItPB.Next()) { + const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value(); + UpdatePaveBlockWithSDVertices(aPB); + } +} +//======================================================================= +//function : InitPaveBlocksForVertex +//purpose : +//======================================================================= +void BOPDS_DS::InitPaveBlocksForVertex(const Standard_Integer theNV) +{ + Standard_Integer nE; + BOPCol_ListIteratorOfListOfInteger aItLE; + // + if (myMapVE.IsBound(theNV)) { + const BOPCol_ListOfInteger& aLE=myMapVE.Find(theNV); + aItLE.Initialize(aLE); + for (; aItLE.More(); aItLE.Next()) { + nE=aItLE.Value(); + ChangePaveBlocks(nE); + } + } +} diff --git a/src/BOPTools/BOPTools_AlgoTools.cdl b/src/BOPTools/BOPTools_AlgoTools.cdl index 77eebf826f..9c777684fa 100644 --- a/src/BOPTools/BOPTools_AlgoTools.cdl +++ b/src/BOPTools/BOPTools_AlgoTools.cdl @@ -288,10 +288,10 @@ is theS :out Shape from TopoDS); CorrectTolerances (myclass; - theS: Shape from TopoDS; - theTolMax: Real from Standard =0.0001; - theRunParallel: Boolean from Standard=Standard_False); - + theS: Shape from TopoDS; + theMapToAvoid:IndexedMapOfShape from BOPCol; + theTolMax: Real from Standard =0.0001; + theRunParallel: Boolean from Standard=Standard_False); ---Purpose: -- Provides valid values of tolerances for the shape -- is max value of the tolerance that can be @@ -300,21 +300,23 @@ is -- perform. CorrectCurveOnSurface (myclass; - theS: Shape from TopoDS; - theTolMax: Real from Standard =0.0001; - theRunParallel: Boolean from Standard=Standard_False); + theS: Shape from TopoDS; + theMapToAvoid:IndexedMapOfShape from BOPCol; + theTolMax: Real from Standard =0.0001; + theRunParallel: Boolean from Standard=Standard_False); ---Purpose: -- Provides valid values of tolerances for the shape -- in terms of BRepCheck_InvalidCurveOnSurface. CorrectPointOnCurve (myclass; - theS: Shape from TopoDS; - theTolMax: Real from Standard =0.0001; - theRunParallel: Boolean from Standard=Standard_False); + theS: Shape from TopoDS; + theMapToAvoid:IndexedMapOfShape from BOPCol; + theTolMax: Real from Standard =0.0001; + theRunParallel: Boolean from Standard=Standard_False); ---Purpose: -- Provides valid values of tolerances for the shape -- in terms of BRepCheck_InvalidPointOnCurve. - + MakeNewVertex (myclass; aP1 : Pnt from gp; aTol: Real from Standard; @@ -440,6 +442,7 @@ is CorrectShapeTolerances (myclass; theS: Shape from TopoDS; + theMapToAvoid:IndexedMapOfShape from BOPCol; theRunParallel: Boolean from Standard=Standard_False); ---Purpose: -- Corrects tolerance values of the sub-shapes of the shape if needed. diff --git a/src/BOPTools/BOPTools_AlgoTools_1.cxx b/src/BOPTools/BOPTools_AlgoTools_1.cxx index 10efe77184..6f2d037f83 100644 --- a/src/BOPTools/BOPTools_AlgoTools_1.cxx +++ b/src/BOPTools/BOPTools_AlgoTools_1.cxx @@ -85,11 +85,13 @@ static void CheckEdge (const TopoDS_Edge& E, - const Standard_Real aMaxTol); + const Standard_Real aMaxTol, + const BOPCol_IndexedMapOfShape& aMapToAvoid); static void CorrectEdgeTolerance (const TopoDS_Edge& myShape, const TopoDS_Face& S, - const Standard_Real aMaxTol); + const Standard_Real aMaxTol, + const BOPCol_IndexedMapOfShape& aMapToAvoid); static Standard_Boolean Validate(const Adaptor3d_Curve& CRef, const Adaptor3d_Curve& Other, @@ -98,15 +100,23 @@ static Standard_Real& aNewTolerance); static - void CorrectVertexTolerance(const TopoDS_Edge& aE); + void CorrectVertexTolerance(const TopoDS_Edge& aE, + const BOPCol_IndexedMapOfShape& aMapToAvoid); static - void CorrectWires(const TopoDS_Face& aF); + void CorrectWires(const TopoDS_Face& aF, + const BOPCol_IndexedMapOfShape& aMapToAvoid); static - void UpdateEdges(const TopoDS_Face& aF); + void UpdateEdges(const TopoDS_Face& aF, + const BOPCol_IndexedMapOfShape& aMapToAvoid); + +static + void UpdateShape(const TopoDS_Shape& aS, + const Standard_Real aTol, + const BOPCol_IndexedMapOfShape& aMapToAvoid); static Standard_Real IntersectCurves2d(const gp_Pnt& aPV, @@ -124,7 +134,7 @@ static class BOPTools_CPC { public: BOPTools_CPC() - : myMaxTol(1.e-7) { + : myMaxTol(1.e-7), mypMapToAvoid(0L) { } // ~BOPTools_CPC() { @@ -146,13 +156,19 @@ class BOPTools_CPC { return myMaxTol; } // + void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) { + mypMapToAvoid = &aMapToAvoid; + } + // void Perform() { - CheckEdge(myEdge, myMaxTol); + Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null"); + CheckEdge(myEdge, myMaxTol, *mypMapToAvoid); } protected: Standard_Real myMaxTol; TopoDS_Edge myEdge; + const BOPCol_IndexedMapOfShape* mypMapToAvoid; }; // //======================================================================= @@ -172,7 +188,7 @@ typedef BOPCol_Cnt //======================================================================= class BOPTools_CWT { public: - BOPTools_CWT() { + BOPTools_CWT() : mypMapToAvoid(0L) { } // ~BOPTools_CWT() { @@ -182,12 +198,18 @@ class BOPTools_CWT { myFace=aF; } // + void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) { + mypMapToAvoid = &aMapToAvoid; + } + // void Perform() { - CorrectWires(myFace); + Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null"); + CorrectWires(myFace, *mypMapToAvoid); } // protected: TopoDS_Face myFace; + const BOPCol_IndexedMapOfShape* mypMapToAvoid; }; //======================================================================= typedef BOPCol_NCVector BOPTools_VectorOfCWT; @@ -207,7 +229,7 @@ typedef BOPCol_Cnt class BOPTools_CDT { public: BOPTools_CDT() - : myMaxTol(1.e-7) { + : myMaxTol(1.e-7), mypMapToAvoid(0L) { } // ~BOPTools_CDT() { @@ -225,14 +247,20 @@ class BOPTools_CDT { myMaxTol=aMaxTol; } // + void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) { + mypMapToAvoid = &aMapToAvoid; + } + // void Perform() { - CorrectEdgeTolerance (myEdge, myFace, myMaxTol); + Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null"); + CorrectEdgeTolerance (myEdge, myFace, myMaxTol, *mypMapToAvoid); } // protected: Standard_Real myMaxTol; TopoDS_Edge myEdge; TopoDS_Face myFace; + const BOPCol_IndexedMapOfShape* mypMapToAvoid; }; //======================================================================= typedef BOPCol_NCVector BOPTools_VectorOfCDT; @@ -251,7 +279,7 @@ typedef BOPCol_Cnt //======================================================================= class BOPTools_CVT { public: - BOPTools_CVT() { + BOPTools_CVT() : mypMapToAvoid(0L) { } // ~BOPTools_CVT() { @@ -261,12 +289,18 @@ class BOPTools_CVT { myEdge=aE; } // + void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) { + mypMapToAvoid = &aMapToAvoid; + } + // void Perform() { - CorrectVertexTolerance(myEdge); + Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null"); + CorrectVertexTolerance(myEdge, *mypMapToAvoid); } // protected: TopoDS_Edge myEdge; + const BOPCol_IndexedMapOfShape* mypMapToAvoid; }; // //======================================================================= @@ -286,7 +320,7 @@ typedef BOPCol_Cnt //======================================================================= class BOPTools_CET { public: - BOPTools_CET() { + BOPTools_CET() : mypMapToAvoid(0L) { } // ~BOPTools_CET() { @@ -296,12 +330,18 @@ class BOPTools_CET { myFace=aF; } // + void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) { + mypMapToAvoid = &aMapToAvoid; + } + // void Perform() { - UpdateEdges(myFace); + Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null"); + UpdateEdges(myFace, *mypMapToAvoid); } // protected: TopoDS_Face myFace; + const BOPCol_IndexedMapOfShape* mypMapToAvoid; }; //======================================================================= typedef BOPCol_NCVector BOPTools_VectorOfCET; @@ -323,11 +363,12 @@ typedef BOPCol_Cnt //======================================================================= void BOPTools_AlgoTools::CorrectTolerances (const TopoDS_Shape& aShape, + const BOPCol_IndexedMapOfShape& aMapToAvoid, const Standard_Real aMaxTol, const Standard_Boolean bRunParallel) { - BOPTools_AlgoTools::CorrectPointOnCurve(aShape, aMaxTol, bRunParallel); - BOPTools_AlgoTools::CorrectCurveOnSurface(aShape, aMaxTol, bRunParallel); + BOPTools_AlgoTools::CorrectPointOnCurve(aShape, aMapToAvoid, aMaxTol, bRunParallel); + BOPTools_AlgoTools::CorrectCurveOnSurface(aShape, aMapToAvoid, aMaxTol, bRunParallel); } // //======================================================================= @@ -336,6 +377,7 @@ void BOPTools_AlgoTools::CorrectTolerances //======================================================================= void BOPTools_AlgoTools::CorrectPointOnCurve (const TopoDS_Shape& aS, + const BOPCol_IndexedMapOfShape& aMapToAvoid, const Standard_Real aMaxTol, const Standard_Boolean bRunParallel) { @@ -348,6 +390,7 @@ void BOPTools_AlgoTools::CorrectPointOnCurve BOPTools_CPC& aCPC=aVCPC.Append1(); aCPC.SetEdge(aE); aCPC.SetMaxTol(aMaxTol); + aCPC.SetMapToAvoid(aMapToAvoid); } // //====================================================== @@ -360,6 +403,7 @@ void BOPTools_AlgoTools::CorrectPointOnCurve //======================================================================= void BOPTools_AlgoTools::CorrectCurveOnSurface (const TopoDS_Shape& aS, + const BOPCol_IndexedMapOfShape& aMapToAvoid, const Standard_Real aMaxTol, const Standard_Boolean bRunParallel) { @@ -373,6 +417,7 @@ void BOPTools_AlgoTools::CorrectCurveOnSurface // BOPTools_CWT& aCWT=aVCWT.Append1(); aCWT.SetFace(aF); + aCWT.SetMapToAvoid(aMapToAvoid); // aExpE.Init(aF, TopAbs_EDGE); for (; aExpE.More(); aExpE.Next()) { @@ -382,6 +427,7 @@ void BOPTools_AlgoTools::CorrectCurveOnSurface aCDT.SetEdge(aE); aCDT.SetFace(aF); aCDT.SetMaxTol(aMaxTol); + aCDT.SetMapToAvoid(aMapToAvoid); } } // @@ -397,6 +443,7 @@ void BOPTools_AlgoTools::CorrectCurveOnSurface //======================================================================= void BOPTools_AlgoTools::CorrectShapeTolerances (const TopoDS_Shape& aShape, + const BOPCol_IndexedMapOfShape& aMapToAvoid, const Standard_Boolean bRunParallel) { TopExp_Explorer aExp; @@ -408,6 +455,7 @@ void BOPTools_AlgoTools::CorrectShapeTolerances const TopoDS_Edge& aE = *(TopoDS_Edge*)&aExp.Current(); BOPTools_CVT& aCVT=aVCVT.Append1(); aCVT.SetEdge(aE); + aCVT.SetMapToAvoid(aMapToAvoid); } // //====================================================== @@ -419,6 +467,7 @@ void BOPTools_AlgoTools::CorrectShapeTolerances const TopoDS_Face& aF = *(TopoDS_Face*)&aExp.Current(); BOPTools_CET& aCET=aVCET.Append1(); aCET.SetFace(aF); + aCET.SetMapToAvoid(aMapToAvoid); } // //====================================================== @@ -431,7 +480,8 @@ void BOPTools_AlgoTools::CorrectShapeTolerances // purpose : Correct tolerances for Vertices on Edge //======================================================================= void CheckEdge (const TopoDS_Edge& Ed, - const Standard_Real aMaxTol) + const Standard_Real aMaxTol, + const BOPCol_IndexedMapOfShape& aMapToAvoid) { Standard_Real aTolE, aTol, aD2, aNewTolerance, dd; gp_Pnt aPC; @@ -483,7 +533,7 @@ void CheckEdge (const TopoDS_Edge& Ed, if (aD2 > aTol) { aNewTolerance=sqrt(aD2)+dd; if (aNewToleranceUpdateTolerance(aNewTolerance); + UpdateShape(aV, aNewTolerance, aMapToAvoid); } } aItPR.Next(); @@ -505,7 +555,7 @@ void CheckEdge (const TopoDS_Edge& Ed, if (aD2 > aTol) { aNewTolerance=sqrt(aD2)+dd; if (aNewToleranceUpdateTolerance(aNewTolerance); + UpdateShape(aV, aNewTolerance, aMapToAvoid); } } } @@ -518,7 +568,8 @@ void CheckEdge (const TopoDS_Edge& Ed, // Function : CorrectWires // purpose : //======================================================================= -void CorrectWires(const TopoDS_Face& aFx) +void CorrectWires(const TopoDS_Face& aFx, + const BOPCol_IndexedMapOfShape& aMapToAvoid) { Standard_Boolean bIsPeriodic; Standard_Integer i, aNbV; @@ -593,10 +644,8 @@ void CorrectWires(const TopoDS_Face& aFx) }// for (; aIt1.More(); aIt1.Next()) { }// for (; aIt.More(); aIt.Next()) { if (aD2max>aTol2) { - BRep_Builder aBB; - // aTol=sqrt(aD2max); - aBB.UpdateVertex(aV, aTol); + UpdateShape(aV, aTol, aMapToAvoid); } }// for (i=1; i<=aNbV; ++i) { } @@ -666,7 +715,8 @@ Standard_Real IntersectCurves2d(const gp_Pnt& aPV, //======================================================================= void CorrectEdgeTolerance (const TopoDS_Edge& myShape, const TopoDS_Face& S, - const Standard_Real aMaxTol) + const Standard_Real aMaxTol, + const BOPCol_IndexedMapOfShape& aMapToAvoid) { // // 1. Minimum of conditions to Perform @@ -806,9 +856,8 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape, Tol, SameParameter, aNewTol); if (ok) { if (aNewTolUpdateTolerance(aNewTol+Delta); - // - CorrectVertexTolerance(myShape); + UpdateShape(myShape, aNewTol+Delta, aMapToAvoid); + CorrectVertexTolerance(myShape, aMapToAvoid); } } @@ -820,8 +869,8 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape, ok = Validate(myHCurve->Curve(),ACS,Tol,SameParameter, aNewTol); if (ok) { if (aNewTolUpdateTolerance(aNewTol+Delta); - CorrectVertexTolerance(myShape); + UpdateShape(myShape, aNewTol+Delta, aMapToAvoid); + CorrectVertexTolerance(myShape, aMapToAvoid); } } } @@ -876,8 +925,8 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape, Tol,Standard_True, aNewTol); if (okx) { if (aNewTolUpdateTolerance(aNewTol+Delta); - CorrectVertexTolerance(myShape); + UpdateShape(myShape, aNewTol+Delta, aMapToAvoid); + CorrectVertexTolerance(myShape, aMapToAvoid); } } } @@ -888,7 +937,8 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape, //function : CorrectVertexTolerance //purpose : //======================================================================= -void CorrectVertexTolerance(const TopoDS_Edge& aE) +void CorrectVertexTolerance(const TopoDS_Edge& aE, + const BOPCol_IndexedMapOfShape& aMapToAvoid) { Standard_Real aTolE, aTolV; TopoDS_Iterator aIt; @@ -899,8 +949,7 @@ void CorrectVertexTolerance(const TopoDS_Edge& aE) const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aIt.Value()); aTolV=BRep_Tool::Tolerance(aV); if (aTolVUpdateTolerance(aTolE); + UpdateShape(aV, aTolE, aMapToAvoid); } } } @@ -1022,11 +1071,11 @@ Standard_Boolean Validate(const Adaptor3d_Curve& CRef, // Function : UpdateEdges // purpose : //======================================================================= -void UpdateEdges(const TopoDS_Face& aF) +void UpdateEdges(const TopoDS_Face& aF, + const BOPCol_IndexedMapOfShape& aMapToAvoid) { Standard_Real aTolF, aTolE, aTolV; TopoDS_Iterator aItF, aItW, aItE; - BRep_Builder aBB; // aTolE=aTolF= BRep_Tool::Tolerance(aF); aItF.Initialize(aF); @@ -1038,22 +1087,46 @@ void UpdateEdges(const TopoDS_Face& aF) const TopoDS_Edge& aE=*((TopoDS_Edge*)&aItW.Value()); aTolE = BRep_Tool::Tolerance(aE); if (aTolE < aTolF) { - aBB.UpdateEdge(aE, aTolF); + UpdateShape(aE, aTolF, aMapToAvoid); aTolE = aTolF; } - //UpdateVertices(aE); } } else { const TopoDS_Vertex& aV=*(TopoDS_Vertex*)&aItF.Value(); aTolV = BRep_Tool::Tolerance(aV); if (aTolV < aTolE) { - aBB.UpdateVertex(aV, aTolF); + UpdateShape(aV, aTolF, aMapToAvoid); } } } } //======================================================================= +//function : UpdateShape +//purpose : +//======================================================================= +void UpdateShape(const TopoDS_Shape& aS, + const Standard_Real aTol, + const BOPCol_IndexedMapOfShape& aMapToAvoid) +{ + if (aMapToAvoid.Contains(aS)) { + return; + } + // + TopAbs_ShapeEnum aType; + BRep_Builder aBB; + // + aType=aS.ShapeType(); + if (aType==TopAbs_EDGE) { + const TopoDS_Edge& aE = *((TopoDS_Edge*)&aS); + aBB.UpdateEdge(aE, aTol); + } + else if (aType==TopAbs_VERTEX) { + const TopoDS_Vertex& aV = *((TopoDS_Vertex*)&aS); + aBB.UpdateVertex(aV, aTol); + } +} +//======================================================================= // Function : ComputeTolerance // purpose : //======================================================================= diff --git a/src/IntTools/IntTools_Context.cdl b/src/IntTools/IntTools_Context.cdl index 5225edcc3f..484d83956a 100644 --- a/src/IntTools/IntTools_Context.cdl +++ b/src/IntTools/IntTools_Context.cdl @@ -154,7 +154,24 @@ is --- 2. the edge does not contain 3d curve and pcurves (-2) --- 3. projection algorithm failed (-3) --- - + + ComputeVE (me:mutable; + aV : Vertex from TopoDS; + aE : Edge from TopoDS; + aT :out Real from Standard; + aTolVnew:out Real from Standard) + returns Integer from Standard; + ---Purpose: + --- Computes parameter of the vertex aV on + --- the edge aE. + --- Returns zero if the distance between vertex + --- and edge is less than sum of tolerances, + --- otherwise and for following conditions returns + --- negative value + --- 1. the edge is degenerated (-1) + --- 2. the edge does not contain 3d curve and pcurves (-2) + --- 3. projection algorithm failed (-3) + ComputeVF (me:mutable; aV : Vertex from TopoDS; aF : Face from TopoDS; @@ -171,6 +188,23 @@ is --- 2. distance is more than sum of tolerances (-2) --- 3. projection point out or on the boundaries of face (-3) --- + + ComputeVF (me:mutable; + aV : Vertex from TopoDS; + aF : Face from TopoDS; + U : out Real from Standard; + V : out Real from Standard; + aTolVnew:out Real from Standard) + returns Integer from Standard; + ---Purpose: + --- Computes UV parameters of the vertex aV on face aF + --- Returns zero if the distance between vertex and face is + --- less than or equal the sum of tolerances and the projection + --- point lays inside boundaries of the face. + --- For following conditions returns negative value + --- 1. projection algorithm failed (-1) + --- 2. distance is more than sum of tolerances (-2) + --- 3. projection point out or on the boundaries of face (-3) StatePointFace(me:mutable; aF : Face from TopoDS; diff --git a/src/IntTools/IntTools_Context.cxx b/src/IntTools/IntTools_Context.cxx index 9501d58a9e..d4b72c7bd9 100644 --- a/src/IntTools/IntTools_Context.cxx +++ b/src/IntTools/IntTools_Context.cxx @@ -509,6 +509,20 @@ Standard_Integer IntTools_Context::ComputeVE (const TopoDS_Vertex& aV1, const TopoDS_Edge& aE2, Standard_Real& aT) +{ + Standard_Real aTolVnew; + // + return ComputeVE(aV1, aE2, aT, aTolVnew); +} +//======================================================================= +//function : ComputeVE +//purpose : +//======================================================================= +Standard_Integer IntTools_Context::ComputeVE + (const TopoDS_Vertex& aV1, + const TopoDS_Edge& aE2, + Standard_Real& aT, + Standard_Real& aTolVnew) { if (BRep_Tool::Degenerated(aE2)) { return -1; @@ -539,6 +553,8 @@ Standard_Integer IntTools_Context::ComputeVE aTolE2=BRep_Tool::Tolerance(aE2); aTolSum = aTolV1 + aTolE2 + Precision::Confusion(); // + aTolVnew=aDist+aTolE2; + // aT=aProjector.LowerDistanceParameter(); if (aDist > aTolSum) { return -4; @@ -546,7 +562,7 @@ Standard_Integer IntTools_Context::ComputeVE return 0; } //======================================================================= -//function : ComputeVS +//function : ComputeVF //purpose : //======================================================================= Standard_Integer IntTools_Context::ComputeVF @@ -554,6 +570,21 @@ Standard_Integer IntTools_Context::ComputeVF const TopoDS_Face& aF2, Standard_Real& U, Standard_Real& V) +{ + Standard_Real aTolVnew; + // + return ComputeVF(aV1, aF2, U, V, aTolVnew); +} +//======================================================================= +//function : ComputeVF +//purpose : +//======================================================================= +Standard_Integer IntTools_Context::ComputeVF + (const TopoDS_Vertex& aV1, + const TopoDS_Face& aF2, + Standard_Real& U, + Standard_Real& V, + Standard_Real& aTolVnew) { Standard_Real aTolV1, aTolF2, aTolSum, aDist; gp_Pnt aP; @@ -574,7 +605,10 @@ Standard_Integer IntTools_Context::ComputeVF aTolV1=BRep_Tool::Tolerance(aV1); aTolF2=BRep_Tool::Tolerance(aF2); - aTolSum=aTolV1+aTolF2; + // + aTolSum=aTolV1 + aTolF2 + Precision::Confusion(); + aTolVnew=aDist+aTolF2; + // if (aDist > aTolSum) { // the distance is too large return -2; diff --git a/src/IntTools/IntTools_ShrunkRange.cxx b/src/IntTools/IntTools_ShrunkRange.cxx index 98b4b2ab39..796f355fc9 100644 --- a/src/IntTools/IntTools_ShrunkRange.cxx +++ b/src/IntTools/IntTools_ShrunkRange.cxx @@ -187,8 +187,10 @@ void IntTools_ShrunkRange::Perform() return; } // - aTol1 = aTolV1+aTolE; - aTol2 = aTolV2+aTolE; + //aTol1 = aTolV1+aTolE; + //aTol2 = aTolV2+aTolE; + aTol1 = Max(aTolV1, aTolE); + aTol2 = Max(aTolV2, aTolE); // aCoeff1 = (aTolE>0.05) ? 1. : 2.; aCoeff2 = aCoeff1; diff --git a/src/QABugs/QABugs_19.cxx b/src/QABugs/QABugs_19.cxx index 02f24518ed..321a5c59d4 100755 --- a/src/QABugs/QABugs_19.cxx +++ b/src/QABugs/QABugs_19.cxx @@ -2727,14 +2727,14 @@ static Standard_Integer OCC25043 (Draw_Interpretor& theDI, } else { - theDI << "Info. Faulty shape if found in source shape\n"; + theDI << "Info. Faulty shape is found in source shape\n"; } } } } else { - theDI << "Error. Problems are not detected. Test is not performed."; + theDI << "Problems are not detected. Test is not performed."; } return 0; diff --git a/tests/boolean/bopcut_2d/D5 b/tests/boolean/bopcut_2d/D5 index b069a320fb..ccecdc76a2 100644 --- a/tests/boolean/bopcut_2d/D5 +++ b/tests/boolean/bopcut_2d/D5 @@ -1,5 +1,3 @@ -puts "TODO #23876 ALL: Error : The bopcut cannot be built." - restore [locate_data_file case_9_edge.brep] a restore [locate_data_file case_9_wire3.brep] b settolerance a 0.1 diff --git a/tests/boolean/gdml_private/G7 b/tests/boolean/gdml_private/G7 index 1af9cde9a7..fa749685a1 100644 --- a/tests/boolean/gdml_private/G7 +++ b/tests/boolean/gdml_private/G7 @@ -1,5 +1,5 @@ puts "TODO OCC26018 ALL: Error : The area of the resulting shape is" -puts "TODO OCC26018 Linux: Faulty shapes in variables faulty_1 to faulty_" +puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_" source [locate_data_file 20000_et3_401-ta6037.prt.2.gdml.tcl] ## image is differ from application diff --git a/tests/boolean/gdml_private/I6 b/tests/boolean/gdml_private/I6 index 83c1c0d334..0636c290b7 100644 --- a/tests/boolean/gdml_private/I6 +++ b/tests/boolean/gdml_private/I6 @@ -1,5 +1,5 @@ -puts "TODO ?OCC26017 Windows: Faulty shapes in variables faulty_1 to faulty_" -puts "TODO ?OCC26017 Windows: Error : The area of the resulting shape is" +puts "TODO ?OCC26017 ALL: Faulty shapes in variables faulty_1 to faulty_" +puts "TODO ?OCC26017 ALL: Error : The area of the resulting shape is" puts "TODO ?OCC26017 ALL: Error : The gdml is not valid. The area is" source [locate_data_file 20000_et4_401-ta6319.prt.2.gdml.tcl] diff --git a/tests/boolean/volumemaker/B3 b/tests/boolean/volumemaker/B3 index ab548307df..0eea89bdfe 100644 --- a/tests/boolean/volumemaker/B3 +++ b/tests/boolean/volumemaker/B3 @@ -3,7 +3,7 @@ puts "TODO OCC26020 ALL: Error: bopcheck failed" puts "TODO OCC26020 Linux: Faulty shapes in variables faulty_1 to faulty_" -puts "TODO OCC26020 Linux: Error : The area of the resulting shape is" +puts "TODO OCC26020 ALL: Error : The area of the resulting shape is" # planar face plane pln_f1 590.6877421677151 -519.8775759738943 -93.555747452441423 0.64798185367609173 0.7547095802227719 -0.10263024323494339 diff --git a/tests/bugs/modalg_2/bug472_1 b/tests/bugs/modalg_2/bug472_1 index a663055096..a84fa36e4b 100755 --- a/tests/bugs/modalg_2/bug472_1 +++ b/tests/bugs/modalg_2/bug472_1 @@ -1,9 +1,5 @@ puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_" puts "TODO OCC25917 ALL: Error : The square of result shape is" -if { [regexp {Debug mode} [dversion]] } { - puts "TODO OCC25917 ALL: TEST INCOMPLETE" - puts "TODO OCC25917 ALL: Tcl Exception" -} puts "========================" puts " OCC472 " diff --git a/tests/bugs/modalg_2/bug472_2 b/tests/bugs/modalg_2/bug472_2 index bb40ce531a..eb00f2c0dd 100755 --- a/tests/bugs/modalg_2/bug472_2 +++ b/tests/bugs/modalg_2/bug472_2 @@ -1,8 +1,5 @@ -puts "TODO OCC25917 ALL: Error : The command is not valid. The square is" -if { [regexp {Debug mode} [dversion]] } { - puts "TODO OCC25917 ALL: TEST INCOMPLETE" - puts "TODO OCC25917 ALL: Tcl Exception" -} +puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_" +puts "TODO OCC25917 ALL: Error : The square of result shape is" puts "========================" puts " OCC472 " diff --git a/tests/bugs/modalg_2/bug472_3 b/tests/bugs/modalg_2/bug472_3 index db34c1aebe..6c16aa9224 100755 --- a/tests/bugs/modalg_2/bug472_3 +++ b/tests/bugs/modalg_2/bug472_3 @@ -1,8 +1,4 @@ -if { [regexp {Debug mode} [dversion]] } { - puts "TODO OCC25917 ALL: TEST INCOMPLETE" - puts "TODO OCC25917 ALL: Tcl Exception" -} - +puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_" puts "========================" puts " OCC472 " puts "(case 3)" @@ -20,8 +16,6 @@ checkshape b2 bfuse result b1 b2 -set nb_v_good 66 -set nb_e_edge 107 -set square 31657.5 +set square 229.516 set 2dviewer 0 diff --git a/tests/bugs/modalg_5/bug25043 b/tests/bugs/modalg_5/bug25043 index b605450e5b..36cc709d93 100644 --- a/tests/bugs/modalg_5/bug25043 +++ b/tests/bugs/modalg_5/bug25043 @@ -8,13 +8,15 @@ puts "" pload QAcommands restore [locate_data_file bug25043.brep] a +subshape a v 3 +settolerance a_3 0.0005 decho off set info [OCC25043 a] decho on -if { [regexp "Faulty shape if found in source shape" ${info}] == 1 } { +if { [regexp "Faulty shape is found in source shape" ${info}] == 1 } { puts "OK : Good result" -} else { +} elseif { [regexp "Problems are not detected" $info] != 1 } { puts "Error : Wrong result" } -- 2.39.5